getTimestamp()function

getTimestamp(value?: unknown): number | undefined
ParamType
valueunknown
Any value that we want to parse as a valid date.
Return
number | undefined
The timestamp in milliseconds, or undefined if the value couldn't be converted.

Convert an unknown value to a timestamp (milliseconds past Unix epoch), or undefined if it couldn't be converted.

Examples

getTimestamp("1970-01-01T00:00:00Z") // 0