In Javascript, given d=new Date() it might be the case that d.getHours()!=d.getUtcHours().
I can construct a Date object, giving the components explicitly
new Date (y, m, d, hrs, mins)
but if these components are UTC then I have a problem. From the docs
The UTC() method differs from the Date constructor in two ways.
Date.UTC() uses universal time instead of the local time.
Date.UTC() returns a time value as a number instead of creating a Date object.
How do I construct a Date object given UTC components?
according to this answer you can do it like this:
new Date(Date.UTC(year, month, day, hour, minute, second))
How about new Date(Date.UTC(...)), e.g. new Date(Date.UTC(2016, 9, 5, 13, 11, 5)).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With