JavaScript Date getUTCMilliseconds()

Posted by

JavaScript Date getUTCMilliseconds() Tutorial

The JavaScript Date getUTCMilliseconds() method returns the milliseconds (from 0 to 999) of the specified date and time, according to universal time.

Syntax

[dm_code_snippet background=”yes” background-mobile=”yes” slim=”no” line-numbers=”no” bg-color=”#abb8c3″ theme=”dark” language=”php” wrapped=”no” height=”” copy-text=”Copy Code” copy-confirmed=”Copied”]

dateObj.getUTCMilliseconds()

[/dm_code_snippet]

Parameters

This method does not take any parameters.

Return Value

Returns a number between 0 and 999, representing the milliseconds in the specified date according to universal time.

Example

[dm_code_snippet background=”yes” background-mobile=”yes” slim=”no” line-numbers=”no” bg-color=”#abb8c3″ theme=”dark” language=”php” wrapped=”no” height=”” copy-text=”Copy Code” copy-confirmed=”Copied”]

let d = new Date(); 
let milliSeconds = d.getUTCMilliseconds();

console.log(milliSeconds); // will return a number between 0 and 999

[/dm_code_snippet]

Browser Support

The getUTCMilliseconds() method is supported in all major browsers, including Internet Explorer, Firefox, Chrome, Safari, and Opera.

Definition and Usage

The getUTCMilliseconds() method is used to get the milliseconds (from 0 to 999) of the specified date and time, according to universal time.

The getUTCMilliseconds() method returns the milliseconds (from 0 to 999) of the specified date and time, according to universal time. This method is used in conjunction with the getUTCSeconds() and getUTCMinutes() methods to obtain the time in universal time.

It is important to note that this method returns the milliseconds in universal time, not the local time zone. To get the milliseconds in the local time zone, use the getMilliseconds() method.