L
L
likejavascript2014-05-26 10:20:04
JavaScript
likejavascript, 2014-05-26 10:20:04

What is the correct way to store time in a calendar type application?

You need to create a small application like Googe Calendar in which you want to save events for a specific start and end time.
The question is: is it necessary to store the time in the timezone in which the user who created the event is located, or can it be stored in UTC, and when displayed on the calendar, correct according to the current timezone?
Thank you all for your answers, most of them for storing time in unixtime. Tell me, how suitable is this approach for MongoDB? I mean how will the selection be made by dates?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
J
jane jane, 2014-05-26
@ru_janex

I always kept time in unixtime
And the belt can already be pulled out of the user's profile.

A
Alexander N++, 2014-05-26
@sanchezzzhak

Best in UTC.
But you also need to make an adjustment to the time from the zone.

G
GM2mars, 2014-05-26
@GM2mars

In my opinion, it is still more convenient to store time in unixtime for the calendar. If you adjust the time on the client, I can recommend a convenient library with great time processing capabilities momentjs.com

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question