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

StackOverflow https://stackoverflow.com/questions/23641773

  •  22-07-2023
  •  | 
  •  

문제

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

도움이 되었습니까?

해결책

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.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top