Javascript - UTC Date Methods

Introduction

UTC date methods are used for working UTC dates (Universal Time Zone dates):

Method Description
getUTCDate() Same as getDate(), but returns the UTC date
getUTCDay() Same as getDay(), but returns the UTC day
getUTCFullYear() Same as getFullYear(), but returns the UTC year
getUTCHours()Same as getHours(), but returns the UTC hour
getUTCMilliseconds() Same as getMilliseconds(), but returns the UTC milliseconds
getUTCMinutes() Same as getMinutes(), but returns the UTC minutes
getUTCMonth()Same as getMonth(), but returns the UTC month
getUTCSeconds() Same as getSeconds(), but returns the UTC seconds

Demo

var d = new Date();
console.log(d);//from  w  w  w. ja  v  a2s. co m
console.log(d.getUTCHours());
console.log(d.getHours());

Result

Related Topic