Answers for "get current time in js"

19

javascript get current time

var today = new Date();
var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
Posted by: Guest on March-30-2020
0

current time in javascript

new Date().toLocaleString();

>> "09/08/2014, 2:35:56 AM"
Posted by: Guest on December-30-2020
8

javascript current date time

var today = new Date().toLocaleDateString(undefined, {
    day: '2-digit',
    month: '2-digit',
    year: 'numeric',
    hour: '2-digit',
    minute: '2-digit',
    second: '2-digit'
})
Posted by: Guest on April-07-2020
1

get current time in javascript

var d = new Date();
var n = d.toLocaleTimeString();
document.getElementById("timer").innnerHTML = n;
Posted by: Guest on April-24-2021
1

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"
Posted by: Guest on July-10-2020
2

currentTime(); javascript

var d = new Date("2020-12-09T05:30:51.01");
d.getHours(); // => 05
d.getMinutes(); // =>  30
d.getSeconds(); // => 51

/*2020 stand for year
12 stands for moth
and 09 stands for the date.
the T there seperates the date and time
!!!IMPORTANT THE VALUE IS A STRING!!!*/
Posted by: Guest on December-09-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language