getMilliseconds()function

getMilliseconds(from?: PossibleDate, to?: PossibleDate, caller: AnyCaller = getMilliseconds): number
ParamType
fromPossibleDate
Date the duration is measured from (defaults to now).
toPossibleDate
Date the duration is measured to (defaults to now).
callerAnyCaller
Function to attribute a thrown error to (defaults to getMilliseconds itself). Defaults to getMilliseconds
Return
number
Number of milliseconds from from to to (negative if to is before from).
Throws
RequiredError
If from or to cannot be converted to a valid date.

Get the millisecond difference between two dates.

Examples

getMilliseconds("2025-01-01", "2025-01-02") // 86400000