Forum Moderators: open
getUTCDate() Returns the day of the month, according to universal time (from 1-31)
getUTCDay() Returns the day of the week, according to universal time (from 0-6)
getUTCFullYear() Returns the year, according to universal time (four digits)
getUTCHours() Returns the hour, according to universal time (from 0-23)
getUTCMilliseconds() Returns the milliseconds, according to universal time (from 0-999)
getUTCMinutes() Returns the minutes, according to universal time (from 0-59)
getUTCMonth() Returns the month, according to universal time (from 0-11)
getUTCSeconds() Returns the seconds, according to universal time (from 0-59)
setUTCDate() Sets the day of the month of a date object, according to universal time
setUTCFullYear() Sets the year of a date object, according to universal time (four digits)
setUTCHours() Sets the hour of a date object, according to universal time
setUTCMilliseconds() Sets the milliseconds of a date object, according to universal time
setUTCMinutes() Set the minutes of a date object, according to universal time
setUTCMonth() Sets the month of a date object, according to universal time
setUTCSeconds() Set the seconds of a date object, according to universal time
toUTCString() Converts a Date object to a string, according to universal time
UTC() Returns the number of milliseconds in a date string since midnight of January 1, 1970, according to universal time
var dateObj = new Date();
alert(dateObj.getUTCHours() + ':' + dateObj.getUTCMinutes());
I use UTC ... but when the clocks change then this time could be either 1.5 or 3.5 hours.
If the time changes when the clocks change then you're not using UTCI agree, hence my question.
format of '28 May 2014 17:36 (UTC)'
// 28 May 2014 17:36 (UTC) - NB: Remove parentheses around timezone identifier
var date1 = new Date('28 May 2014 17:36 UTC');
var date2 = new Date('28 May 2014 20:06 UTC');
// Calc difference and convert milliseconds to hours (2.5)
var diffHours = (date2 - date1) / 1000 / 60 / 60;