JavaScript Code


JavaScript – Get UTC Hours from Date


Date – getUTCHours()

date.getUTCHours()

getUTCHours() returns the hours of this date object, according to universal time

Examples

1. get the hours from current date according to universal time

let date = new Date();
console.log(date);
console.log(date.getUTCHours());


Copyright @2022