Convert UTC Epoch to local date

I think I have a simpler solution — set the initial date to the epoch and add UTC units. Say you have a UTC epoch var stored in seconds. How about 1234567890. To convert that to a proper date in the local time zone: d is now a date (in my time zone) set to … Read more

How do you convert a JavaScript date to UTC?

The toISOString() method returns a string in simplified extended ISO format (ISO 8601), which is always 24 or 27 characters long (YYYY-MM-DDTHH:mm:ss.sssZ or ±YYYYYY-MM-DDTHH:mm:ss.sssZ, respectively). The timezone is always zero UTC offset, as denoted by the suffix “Z“. Source: MDN web docs The format you need is created with the .toISOString() method. For older browsers … Read more

Difference between UTC and GMT

Astronomy versus Atomic clock By the original definitions the difference is that GMT (also officially known as Universal Time (UT), which may be confusing) is based on astronomical observations while UTC is based on atomic clocks. Later GMT has become to be used at least unofficially to refer to UTC, which blurs the distinction somewhat. GMT stands for Greenwich … Read more