Answer the question
In order to leave comments, you need to log in
In what format to send time from the client (different time zones) and in what format to store and process on the server?
At the moment, my client sends the time in the form 2019-01-25 16:06
(the current time zone of the machine), and the Node / Mongo server (here on the laptop) saves it in the form 2019-01-25 14:06:00.000Z
, and then when the data is returned, filtering by date occurs. Everything works fine locally, for example, the return of published posts by time (i.e. the server translates 2019-01-25 14:06:00.000Z
, I believe, into my local server time, and they are the same on my machine)
The problem occurs when the server is running remotely on a VPS. There is a 2 hour time shift.
I send: 2019-01-25 16:06
And Monga saves not like locally, but 2019-01-25 16:06:00.000Z
Why does this happen, in which video should I send and store time? How to synchronize all this, regardless of the time zone of the client from which the date will be sent and the server where Monga will be spinning?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question