U
U
Urukhayy2018-01-30 06:25:06
JavaScript
Urukhayy, 2018-01-30 06:25:06

How to record time and date in different time zone?

I need the user to be able to enter the date and time of another (any) time zone into the system. How to store it, in a string or in a Date object? And how to translate it from UTC and back, on the server or on the client?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stalker_RED, 2018-01-30
@Urukhayy

Once entered, convert to UTC and store in UTC. Translate only before displaying, on the server or on the client - as you prefer. If users are from different time zones, then it is more convenient on the client, usually.
Easier: https://developer.mozilla.org/ru/docs/Web/JavaScri...
Cooler: https://developer.mozilla.org/ru/docs/Web/JavaScri...
Well, there are a lot of third-party libraries like moment.js

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question