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