javascript milliseconds code example
Example 1: what 1hr in milliseconds in javascript
/*
** Time in milliseconds
1 second = 1000 milliseconds
15 minutes = 900000 milliseconds
30 seconds = 30000 milliseconds
1 minute = 60000 milliseconds
5 minutes = 300000 milliseconds
30 minutes = 1800000 milliseconds
45 minutes = 2700000 milliseconds
1 hour = 3600000 milliseconds
*/
Example 2: js get date in ms
Date.now() // 1602680486141
Example 3: javascript get current time
var date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0));
// formats below assume the local time zone of the locale;
// America/Los_Angeles for the US
// US English uses 12-hour time with AM/PM
console.log(date.toLocaleTimeString('en-US'));
// "7:00:00 PM"
// British English uses 24-hour time without AM/PM
console.log(date.toLocaleTimeString('en-GB'));
// "03:00:00"