That’s all fine Meredydd, but, let’s forget about datepickers for now.
What about the fact I now have data from an Anvil instigated SQL call in an Anvil DB.
Q. What is the best way to restore the ORIGINAL naive datetimes in the DB?
(Because Anvil has changed all my datetimes in the table)
MY STRUGGLES
2019-07-01 11:15:39.577000+00:00
2019-07-01 11:15:39.577000
2019-07-01 11:15:39.577000+10:00
2019-07-01 11:15:39.577000
2019-07-01 11:15:39.577000+09:40
Above are 5 versions of me trying to restore the CORRECT NAIVE datetime:
ptime = ping_rows[0]['SentAt']
ptime_unaware = ptime.replace(tzinfo=None)
ptime_loc = Melb_tz.localize(ptime_unaware)
ptime_loc_unaware = ptime_loc.replace(tzinfo=None)
ptime_loc2_unaware = ptime_loc.replace(tzinfo=Melb_tz)
where
Melb_tz = pytz.timezone('Australia/Melbourne')
The correct datetime should be:
2019-07-01 21:15:39.577000
(but I am of course annoyed, in the first place, that I need to correct it back to its value from our company MS SQL DB).