Addressing the different timestamps for created_on because of different time zones

17 views
Skip to first unread message

mostwanted

unread,
Jun 29, 2019, 11:21:17 PM6/29/19
to web2py-users
Hi guys, my application is being hosted on pythonanywhere, when i retrieve user inputs and their created_on date & timestamps to display them the timestamps come different from the time of my location. We are 2hrs ahead, is there a way i can have these timestamps similar to the that of my time zone??

Regards

Mostwanted

Dave S

unread,
Jun 30, 2019, 3:38:48 AM6/30/19
to web2py-users

Take a look at the python datetime module, and functions such as datetime.astimezone(tz).

If you need to detect timezones on your client, that can be tricky, but there is a discussion from 2013 in the archives.

Also a strong suggestion to always store UTC, whatever you display it as.

/dps

Reply all
Reply to author
Forward
0 new messages