The base date as a Date object or timestamp (number)
The milliseconds as a number (0-999), or NaN if invalid
// Get milliseconds from Date object
const result = getMilliseconds(new Date(2024, 0, 15, 12, 30, 45, 123));
// Returns: 123
// Get milliseconds from timestamp
const result2 = getMilliseconds(1704067200500); // 500ms past epoch
// Returns: 500
// Start of second (0 milliseconds)
const result3 = getMilliseconds(new Date(2024, 0, 1, 0, 0, 0, 0));
// Returns: 0
// End of second (999 milliseconds)
const result4 = getMilliseconds(new Date(2024, 0, 1, 0, 0, 0, 999));
// Returns: 999
// Invalid date returns NaN
const result5 = getMilliseconds(new Date("invalid"));
// Returns: NaN
Get the milliseconds of the given date.
This function validates arguments before processing and returns the milliseconds component (0-999) of the given date. Returns NaN for invalid input.