JavaScript Code


JavaScript – Get UTC Month from Date


Date – getUTCMonth()

date.getUTCMonth()

getUTCMonth() returns an integer representing the month of this date object, according to universal time. 0 is January, 1 is February, 2 is March, and so on.

Examples

1. Get the month from current date according to universal time.

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


Copyright @2022