This is the latest docs version
Quick Links
  • -Overview
  • -Language Features
  • -JS Interop
  • -Build System
Documentation
Language Manual
Reference for all language features
ReScript & React
First class bindings for ReactJS
GenType
Seamless TypeScript integration
Reanalyze
Dead Code & Termination analysis
Exploration
Packages
Explore third party libraries and bindings
Syntax Lookup
Discover all syntax constructs
APIPlaygroundBlogCommunity
  • Playground
  • Blog
  • Twitter
  • GitHub
  • Forum
Core Module
Overview
Core
submodules
  • Array
  • ArrayBuffer
  • AsyncIterator
  • BigInt
  • BigInt64Array
    • Constants
    BigUint64Array
    • Constants
  • Console
  • DataView
  • Date
    • UTC
      • v
        makeWithYM
      • v
        makeWithYMD
      • v
        makeWithYMDH
      • v
        makeWithYMDHM
      • v
        makeWithYMDHMS
      • v
        makeWithYMDHMSM
  • Dict
  • Error
    • URIError
    • TypeError
    • SyntaxError
    • ReferenceError
    • RangeError
    • EvalError
  • Exn
  • Float
    • Constants
    Float32Array
    • Constants
    Float64Array
    • Constants
    Int
    • Constants
    Int16Array
    • Constants
    Int32Array
    • Constants
    Int8Array
    • Constants
  • Internal
  • Intl
    • Segments
    • Segmenter
    • RelativeTimeFormat
    • PluralRules
    • NumberFormat
      • Grouping
    • Locale
    • ListFormat
    • DateTimeFormat
    • Collator
    • Common
  • Iterator
  • JSON
    • Decode
    • Encode
    • Classify
  • List
  • Map
  • MapperRt
  • Math
    • Int
    • Constants
  • Null
  • Nullable
  • Object
  • Option
  • Ordering
  • Promise
  • Re
    • Result
    RegExp
    • Result
  • Result
  • Set
  • String
  • Symbol
  • Type
    • Classify
  • TypedArray
  • Uint16Array
    • Constants
    Uint32Array
    • Constants
    Uint8Array
    • Constants
    Uint8ClampedArray
    • Constants
  • WeakMap
  • WeakSet
  • API / Core / Date / Utc

    UTC

    makeWithYM

    RESCRIPT
    let makeWithYM: (~year: int, ~month: int) => msSinceEpoch

    Returns the time, in milliseconds, since UNIX epoch (January 1, 1970 00:00:00 UTC). Be aware of using a value for year < 100, because it behaves inconsistent (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#interpretation_of_two-digit_years). Months are 0-indexed (0 = January, 11 = December). Values, which are out of range, will be carried over to the next bigger unit (s. example).

    Examples

    RESCRIPT
    Date.UTC.makeWithYM(~year=2023, ~month=0) // 1672531200000 Date.UTC.makeWithYM(~year=2023, ~month=11) // 1701388800000 Date.UTC.makeWithYM(~year=2023, ~month=12) // 1704067200000 Date.UTC.makeWithYM(~year=2023, ~month=-1) // 1669852800000

    makeWithYMD

    RESCRIPT
    let makeWithYMD: (~year: int, ~month: int, ~date: int) => msSinceEpoch

    Returns the time, in milliseconds, since UNIX epoch (January 1, 1970 00:00:00 UTC). Be aware of using a value for year < 100, because it behaves inconsistent (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#interpretation_of_two-digit_years). Months are 0-indexed (0 = January, 11 = December). Values, which are out of range, will be carried over to the next bigger unit (s. example).

    Examples

    RESCRIPT
    Date.UTC.makeWithYMD(~year=2023, ~month=1, ~date=20) // 1676851200000 Date.UTC.makeWithYMD(~year=2023, ~month=1, ~date=-1) // 1675036800000 Date.UTC.makeWithYMD(~year=2023, ~month=1, ~date=29) // 1677628800000

    makeWithYMDH

    RESCRIPT
    let makeWithYMDH: ( ~year: int, ~month: int, ~date: int, ~hours: int, ) => msSinceEpoch

    Returns the time, in milliseconds, since UNIX epoch (January 1, 1970 00:00:00 UTC). Be aware of using a value for year < 100, because it behaves inconsistent (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#interpretation_of_two-digit_years). Months are 0-indexed (0 = January, 11 = December). Values, which are out of range, will be carried over to the next bigger unit (s. example).

    Examples

    RESCRIPT
    Date.UTC.makeWithYMDH(~year=2023, ~month=1, ~date=20, ~hours=16) // 1676908800000 Date.UTC.makeWithYMDH(~year=2023, ~month=1, ~date=20, ~hours=24) // 1676937600000 Date.UTC.makeWithYMDH(~year=2023, ~month=1, ~date=20, ~hours=-1) // 1676847600000

    makeWithYMDHM

    RESCRIPT
    let makeWithYMDHM: ( ~year: int, ~month: int, ~date: int, ~hours: int, ~minutes: int, ) => msSinceEpoch

    Returns the time, in milliseconds, since UNIX epoch (January 1, 1970 00:00:00 UTC). Be aware of using a value for year < 100, because it behaves inconsistent (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#interpretation_of_two-digit_years). Months are 0-indexed (0 = January, 11 = December). Values, which are out of range, will be carried over to the next bigger unit (s. example).

    Examples

    RESCRIPT
    Date.UTC.makeWithYMDHM(~year=2023, ~month=1, ~date=20, ~hours=16, ~minutes=40) // 1676911200000 Date.UTC.makeWithYMDHM(~year=2023, ~month=1, ~date=20, ~hours=16, ~minutes=60) // 1676912400000 Date.UTC.makeWithYMDHM(~year=2023, ~month=1, ~date=20, ~hours=16, ~minutes=-1) // 1676908740000

    makeWithYMDHMS

    RESCRIPT
    let makeWithYMDHMS: ( ~year: int, ~month: int, ~date: int, ~hours: int, ~minutes: int, ~seconds: int, ) => msSinceEpoch

    Returns the time, in milliseconds, since UNIX epoch (January 1, 1970 00:00:00 UTC). Be aware of using a value for year < 100, because it behaves inconsistent (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#interpretation_of_two-digit_years). Months are 0-indexed (0 = January, 11 = December). Values, which are out of range, will be carried over to the next bigger unit (s. example).

    Examples

    RESCRIPT
    Date.UTC.makeWithYMDHMS(~year=2023, ~month=1, ~date=20, ~hours=16, ~minutes=40, ~seconds=0) // 1676911200000 Date.UTC.makeWithYMDHMS(~year=2023, ~month=1, ~date=20, ~hours=16, ~minutes=40, ~seconds=60) // 1676911260000 Date.UTC.makeWithYMDHMS(~year=2023, ~month=1, ~date=20, ~hours=16, ~minutes=40, ~seconds=-1) // 1676911199000

    makeWithYMDHMSM

    RESCRIPT
    let makeWithYMDHMSM: ( ~year: int, ~month: int, ~date: int, ~hours: int, ~minutes: int, ~seconds: int, ~milliseconds: int, ) => msSinceEpoch

    Returns the time, in milliseconds, since UNIX epoch (January 1, 1970 00:00:00 UTC). Be aware of using a value for year < 100, because it behaves inconsistent (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#interpretation_of_two-digit_years). Months are 0-indexed (0 = January, 11 = December). Values, which are out of range, will be carried over to the next bigger unit (s. example).

    Examples

    RESCRIPT
    Date.UTC.makeWithYMDHMSM(~year=2023, ~month=1, ~date=20, ~hours=16, ~minutes=40, ~seconds=0, ~milliseconds=0)->Console.log // 1676911200000 Date.UTC.makeWithYMDHMSM(~year=2023, ~month=1, ~date=20, ~hours=16, ~minutes=40, ~seconds=0, ~milliseconds=1000)->Console.log // 1676911201000 Date.UTC.makeWithYMDHMSM(~year=2023, ~month=1, ~date=20, ~hours=16, ~minutes=40, ~seconds=0, ~milliseconds=-1)->Console.log // 1676911199999
    Types and values
    • v
      makeWithYM
    • v
      makeWithYMD
    • v
      makeWithYMDH
    • v
      makeWithYMDHM
    • v
      makeWithYMDHMS
    • v
      makeWithYMDHMSM

    © 2024 The ReScript Project

    Software and assets distribution powered by KeyCDN.

    About
    • Community
    • ReScript Association
    Find us on