Given the following code:
var date = new Date("2014-02-26T15:52:30");
date.getUTCHours();
// Outputs
// Chrome: 15
// Firefox: 18
// IE: 18
I'm not sure which date method I should use. Date.getHours
returns the correct hour in FF and IE, but incorrect in Chrome. And Date.getUTCHours()
is showing me the correct date, but is not ok in both IE and FF. What are the differences anyway? What UTC date is supposed to be?
I wonder if is there a CrossBrowser native solution... I wouldn't like to use a library for such a simple thing.