Kijana Woodard

Software Minimalism


Javascript UTC Datetime

Tuesday, June 5, 2012

I created a date in js like this: new Date(2012, 0, 1, 8, 15, 0);.

When I console.log it, I get this: 2012-01-01T14:15:00.000Z (My timezone is CST).

The date is already converted to UTC and will convert back to local time for display. If you ship the date to js as UTC, it just works.

Once again, if you think you need to write a bunch of code to solve a common business problem, you're thinking incorrectly about the problem, the solution, or both.



If you see a mistake in the post *or* you want to make a comment, please submit an edit.

You can also contact me and I'll post the comment.

0 Comments...