JavaScript getUTCMilliseconds Date Function returns the Milliseconds on a given date according to universal time. The syntax of the getUTCMilliseconds function is:
Date.getUTCMilliseconds()
JavaScript getUTCMilliseconds Example
We used the getUTCMilliseconds function to return the total milliseconds as per the universal time from the current date and time.
<!DOCTYPE html> <html> <head> <title> JavaScriptGetUTCMillisecondsFunction </title> </head> <body> <h1> JavaScriptgetUTCMillisecondsFunctionExample </h1> <script> var dt = Date(); document.write("Date and Time : " + dt); document.write("UTC Milliseconds using getUTCMilliseconds : " + dt.getUTCMilliseconds()); </script> </body> </html>
In this JavaScript get UTC Milliseconds example, we will display the Milliseconds from the custom date and time as per universal time.
<!DOCTYPE html> <html> <head> <title> JS </title> </head> <body> <h1> Example </h1> <script> var dt = Date("April 1, 2017 10:12:22.0716"); document.write("Date and Time : " + dt); document.write("UTC Milliseconds : " + dt.getUTCMilliseconds()); </script> </body> </html>
Example
Date and Time: Sat Apr 01 2017 10:12:22 GMT+0530 (Indian Standard Time)
UTC Milliseconds : 71