Trouble getting the date
fgbbd
HOBBYOP

a year ago

This sounds like a joke, but i can't get the date right.

In my machine, shows the date correctly, but when running it on Railway, it just shows day before
I guess i could add one but that just seems incorrect. I'm sorry if this is a newbie problem but i just can't solve it.

madrid_tz = pytz.timezone('Europe/Madrid')
DATE = datetime.datetime.now(pytz.utc).astimezone(madrid_tz).strftime('%Y-%m-%d')
BACKUP_FILE = os.path.join(f"backup_{DATE}.sql")
Solved

16 Replies

fgbbd
HOBBYOP

a year ago

3bddd6c1-71a7-4fd4-bfd6-33338404fdca


fgbbd
HOBBYOP

a year ago

The script is run 10AM CET btw


brody
EMPLOYEE

a year ago

where is that log being printed


fgbbd
HOBBYOP

a year ago

Thank you for answering. It's been printed here

1343243858992955400


brody
EMPLOYEE

a year ago

the timestamp on the left is a localized timestamp according to your browser


fgbbd
HOBBYOP

a year ago

ok…


fgbbd
HOBBYOP

a year ago

😅 but why python is getting 22 if it's been run on 23?


fgbbd
HOBBYOP

a year ago

idk if i'm explianing myself correctly


brody
EMPLOYEE

a year ago

what date is correct, you tell me haha


fgbbd
HOBBYOP

a year ago

oh okay, railway one is correct


fgbbd
HOBBYOP

a year ago

the log one


brody
EMPLOYEE

a year ago

then your timezone conversion is wrong in code


fgbbd
HOBBYOP

a year ago

it works in my machine 🤣 🤣 okay i guess that isnt railway related then, ty for answering


fgbbd
HOBBYOP

a year ago

how do i close this?


brody
EMPLOYEE

a year ago

it's something mods / admins have to do


brody
EMPLOYEE

a year ago

!s


Status changed to Solved brody 12 months ago


Loading...