Skip to content
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
Cannot retrieve contributors at this time
Local vs UTC vs Offset

Moment offers three functions for parsing dates, the basic moment function, moment.utc, and moment.parseZone.

If you wish to interact with a date in the context of the user's local time, use the moment function.


This results in a date with a UTC offset that is the same as the local computer:


If you wish to interact with the date as a UTC date, use moment.utc:


This results in a date with a utc offset of +0:00:


If your date format has a fixed timezone offset, use moment.parseZone:


This results in a date with a fixed offset:


Note that if you use moment() or moment.utc() to parse a date with a specified offset, the date will be converted from that offset to either local or UTC:

This date is shifted by 8 hours, moving from +2 to -6 (the offset of the local machine)


This date is shifted by 2 hours, moving from +2 to UTC