Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaScript dates - what is the difference between getMinutes() and getUTCMinutes()?

It seems like both functions return a number between 0 and 59.

like image 906
tadasajon Avatar asked May 13 '14 21:05

tadasajon


2 Answers

There are a handful of timezones that are not offset by UTC by a multiple of hours, but have an additional half hour. You can see the list at Half hour time zones, and they include India, so it's not an insignificant portion of the world by any means. If you're in one of these timezones, getMinutes and getUTCMinutes of the current time will be 30 minutes different.

And there are two locations, Nepal and Chatham Islands, that have an additional 45 minutes in their offset from UTC.

like image 178
Barmar Avatar answered Oct 21 '22 02:10

Barmar


One is based on the universal time (also known as GMT) one is relative time of the client. So the base they call from is different. I did find some time zones do have partial hours, so the minutes can be different.

like image 38
Fyona Avatar answered Oct 21 '22 02:10

Fyona