Date.getUTCMilliseconds()

Returns the milliseconds, according to universal time (from 0-999)

The getUTCMilliseconds() method returns the milliseconds in the specified date according to universal time.

var exampleDate = new Date('2018-01-02T03:04:05.678Z'); // 2 January 2018, 03:04:05.678 (UTC)

console.log(exampleDate.getUTCMilliseconds());
// expected output: 678

Syntax

dateObj.getUTCMilliseconds()

Return value

An integer number, between 0 and 999, representing the milliseconds in the given date according to universal time.

Examples

Using getUTCMilliseconds()

The following example assigns the milliseconds portion of the current time to the variable milliseconds.

var today = new Date();
var milliseconds = today.getUTCMilliseconds();

References

Contributors to this page

Uros Durdevic

Last updated