R
Railway8mo ago
Fury_21

time zone

How to configure the time zone for my project so that it is UTC-5, which is from Lima, or I have also tried America/Lima this way, but it doesn't work for me because by default it outputs UTC+0, in my location it outputs normally, the datalle is when I place it in the Railway, I have tried to place the TZ as a variable in my project in railway but it doesn't work either.
No description
No description
No description
Solution:
you should always keep the server timezone in UTC as that is standard, then simply convert to the desired timezone for display purposes
Jump to solution
22 Replies
Percy
Percy8mo ago
Project ID: N/A
Fury_21
Fury_21OP8mo ago
N/A
Solution
Brody
Brody8mo ago
you should always keep the server timezone in UTC as that is standard, then simply convert to the desired timezone for display purposes
Fury_21
Fury_21OP8mo ago
For example, I have a column that is auto_now_add=True and that's exactly what it comes out with UTC+0, but I have another one that is a normal date default=timezone.now and that normal one does come out with my time zone
Brody
Brody8mo ago
as mentioned, you want to keep all time stamps in UTC, as that is standard
Fury_21
Fury_21OP8mo ago
I'm going to deploy again with the fixes
Fury_21
Fury_21OP8mo ago
nothing comes out the same with UTC+0
No description
Brody
Brody8mo ago
what do you mean "comes out"
Fury_21
Fury_21OP8mo ago
It's the same as before
Brody
Brody8mo ago
I'm not seeing any issues with that screenshot, perhaps I'm missing some context
Fury_21
Fury_21OP8mo ago
What is in red is my current time and what is in green is the response when consuming my api, in theory my same current date should appear, but tomorrow's date appears.
No description
Brody
Brody8mo ago
yes, the date stamp on the left is localized, the date on the right is utc, there are no issues here
Fury_21
Fury_21OP8mo ago
If there is a problem, because when you register today's date, tomorrow's date appears.
Brody
Brody8mo ago
you simply look at the timestamp on the left
Fury_21
Fury_21OP8mo ago
I don't think you let me explain. I have a reserve table and when I consume, for example, today the 14th at 11 p.m., it registers it with the date of tomorrow the 15th at 4 a.m. because there is a difference of 5 hours.
Brody
Brody8mo ago
saw that not sure why you where showing me console logs, in that case please read over my first message and it does cover the correct solution.
Fury_21
Fury_21OP8mo ago
That's why I did what you told me about UTC, but nothing.
Brody
Brody8mo ago
please read the second half of the message
Fury_21
Fury_21OP8mo ago
to convert it to the desired time zone for display purposes?
Brody
Brody8mo ago
yes, you store all your timestamps in UTC and convert the timestamp to the users local time for display purposes
Fury_21
Fury_21OP8mo ago
goes
Brody
Brody8mo ago
please stop with the ping replies, we are the only two people in this thread
Want results from more Discord servers?
Add your server