Using JavaScript Date Objects we can get the current hour, minute and second as well as manipulate those numbers.
Get Hour
The getHours() method returns the current hour of any specified date. It will return hour from 0 to 23.
So, we can create a date object first and then using that date we can get the hour.
var d = new Date();
console.log(d.getHours());
// 2
Get Minute
The getMinutes() method returns the current minutes from a date as a number from 0 to 59.
So, similarly like hour, we can create a date object first and then using that date we can get the current minute.
var d = new Date();
console.log(d.getMinutes());
// 8
Get Second
The getSeconds() method returns the second of a date as a number between 0 to 59.
So, similarly like hour and minute, we can create a date object first and then using that date we can get the current second.
var d = new Date();
console.log(d.getSeconds());
// 14
date functions getHours getMinutes getSeconds time timestamp