API / Utilities / dateTimeParse

dateTimeParse(input, options?): undefined | DateTime

Defined in: src/parser/parser.ts:42

Parses a number, text or Date to a DateTime value. If a timeZone is supplied the incoming value
is parsed with that timeZone as a base.

It can also parse the relative date and time format, e.g. 'now-6h' will be parsed as Date.now() - 6 hours and
returned as a valid DateTime value.

Parameters

Parameter Type
input unknown
options? DateTimeOptionsWhenParsing

Returns

undefined | DateTime