Skip to content

Instantly share code, notes, and snippets.

@Noitidart
Last active February 26, 2021 15:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Noitidart/b863147a00b31c569482e3687a934c4e to your computer and use it in GitHub Desktop.
Save Noitidart/b863147a00b31c569482e3687a934c4e to your computer and use it in GitHub Desktop.

Getting Unix In New York (Date.now() as if "run in New York at a given time")

// get utc of Feb2 2021 10am in New York - moment.tz('America/New_York').month(1).date(2).hour(10).minute(0).second(0).valueOf()
// now with the return of the above is Date.now() as if i ran it in New York timezone on Feb2 2021 10am - so doing moment.utc(1612278000203).tz('America/New_York').format('llll') gives 'Tue, Feb 2, 2021 10:00 AM'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment