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);//ww  w . j a  v a  2s.  c o  m
console.log(d.getUTCHours());
console.log(d.getHours());

Result

Related Topic