Skip to content
Advertisements

JavaScript Date.getMilliseconds()

Why getMilliseconds ?

Javascript Date The getMilliseconds () method returns what is requested by the specified date. In the getMilliseconds () method, the desired value is milliseconds. Therefore, this method returns milliseconds. This value is a number between 0 and 999.

Syntax:

Date.getMilliseconds()

return: Returns the milliseconds in the specified date according to local time.


JavaScript getMilliseconds Examples

Example 1

The JavaScript getMilliseconds method can return the second of the current time.

        var now = new Date();
        console.log(now.getMilliseconds());

625


Example 2

The JavaScript getMilliseconds method returns the second of the desired time.

        var date = new Date('November 26,12 15:22:18:243');
        console.log(date.getMilliseconds());

243


Example 3

An error does not occur unless the number exceeds 999.

        var date = new Date('July 21, 1983 01:15:00:999');
        console.log(date.getMilliseconds());

999


Example 4

        var date = new Date('July 21, 1983 01:15:00:1112');
        console.log(date.getMilliseconds());

0


Browser Support

Chromeyes
Edgeyes
Firefox1
Internet Exploreryes
Operayes
Safariyes
Android webviewyes
Chrome for Androidyes
Edge mobileyes
Firefox for Android4
Opera Androidyes
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: