getMilliseconds()function
getMilliseconds(from?: PossibleDate, to?: PossibleDate, caller: AnyCaller = getMilliseconds): number
| Param | Type | |
|---|---|---|
from | PossibleDate | Date the duration is measured from (defaults to now). |
to | PossibleDate | Date the duration is measured to (defaults to now). |
caller | AnyCaller | 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