Published Jun 19, 2023
Contribute to Docs

The .getUTCMilliseconds() method returns the milliseconds for the provided Date object, according to universal time (not be be confused with the .getMilliseconds() method).



The .getUTCMilliseconds() method will return an integer between 0 and 999, which represents the milliseconds for the given date, myDate, according to universal time.

The method will return NaN if the date is invalid.


In the given example, .getUTCMilliseconds() is applied to the constant selectedDate and logged to the console.

const selectedDate = new Date('2020-08-09T01:32:28.412+01:00');

The code will result in the following output:


All contributors

Looking to contribute?

Learn JavaScript on Codecademy