R
Railway7mo ago
Diemax

My database in Railway change my data

Hi! I have a project working in Railway with the backend and Database in MySQL, the problem it's... My program sends to the database a date, but it date when is creates in the database MySQL of Railway, is the last day. For example, today is 2024/05/13, well if I create a data in the database, my database save the data like 2024/05/12. I thought than was a problem of FrontEnd, but no, because when I make a SELECT in the database from DBeaver, it shows me with the date of today. Please if there is a person than knows like fix this, thanks!!
Solution:
Railway's databases follow best practice, which is to save any timestamps in the UTC time zone
Jump to solution
13 Replies
Percy
Percy7mo ago
Project ID: N/A
Diemax
DiemaxOP7mo ago
N/A
Brody
Brody7mo ago
I would not recommend you use the data tab for anything other than a "yeah there's some data here" check, it's full of bugs that are more dangerous to your data than an incorrect date
Diemax
DiemaxOP7mo ago
Excuse me, I don´t understand, can you be more clear please?
Brody
Brody7mo ago
I'm sorry but I don't know what I could say to clarify further
Solution
Adam
Adam7mo ago
Railway's databases follow best practice, which is to save any timestamps in the UTC time zone
Adam
Adam7mo ago
As Brody said, the data tab is not reliable. If you want to view your data, please continue using dbeaver
Diemax
DiemaxOP7mo ago
Ahhh, now I understand... Thank you so much, and yes, it's probably than the data tab has bugs, but in my program when I read a register of my table, I get the date with the date of the previous day.
Diemax
DiemaxOP7mo ago
For example, this is my program, and this bill is of today, but I get from database of Railway than the bill is of yesterday. When that is false.
No description
Brody
Brody7mo ago
as Adam said, the date is stored in UTC which is standard practise, your app should handle converting that UTC timestamp to the users desired time zone
Diemax
DiemaxOP7mo ago
So I understand for it in DBeaver my database show the correct data and date but the problem it's in the front, when I get the data. I will search what method I use to do the converting, thanks!! @Brody You were rigth, my problem was UTC, I made the changes and now my program work perfect, thanks!!
Adam
Adam7mo ago
that was my suggestion :(
Brody
Brody7mo ago
hey I did give you credit :kekw:
Want results from more Discord servers?
Add your server