N
N
Nikolai Khoziashev2022-01-18 01:49:43
JavaScript
Nikolai Khoziashev, 2022-01-18 01:49:43

date-fns has a getISODay() method, how can I convert the result of the method, taking into account the offset of the front, if the back is 10800 (+3), and the front itself is 28800 (+8)?

date-fns has a getISODay() method, how can I convert the result of the method, taking into account the offset of the front, if the back is 10800 (+3), and the front itself is 28800 (+8)
thanks)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
hint000, 2022-01-18
@hint000

((+8 (Irkutsk?))-(+3 (Moscow?)))*60(seconds in a minute)*60(minutes in an hour)+10800(seconds from midnight in Moscow)=28800(seconds from midnight in Irkutsk )
In general, it is recommended to store UTC time in the database (it is also GMT + 0), in order to avoid confusion (you can additionally store the time zone). So you can do +3*60*60 on the back and +8*60*60 on the front and get GMT+0 in both cases.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question