Message279761
With %z, the result gets a tzinfo, but with %Z, it succeeds but the result is without timezone info:
>>> datetime.datetime.strptime('2016-10-31T03:58:24 CST', '%Y-%m-%dT%H:%M:%S %Z')
datetime.datetime(2016, 10, 31, 3, 58, 24)
>>> datetime.datetime.strptime('2016-10-31T03:58:24 +0800', '%Y-%m-%dT%H:%M:%S %z')
datetime.datetime(2016, 10, 31, 3, 58, 24, tzinfo=datetime.timezone(datetime.timedelta(0, 28800)))
So the first one loses infomation (and will result in wrong values if the programmer isn't aware of this, and the local timezone is different than the one in the string). |
|
Date |
User |
Action |
Args |
2016-10-31 05:48:57 | lilydjwg | set | recipients:
+ lilydjwg |
2016-10-31 05:48:57 | lilydjwg | set | messageid: <1477892937.56.0.524633393868.issue28565@psf.upfronthosting.co.za> |
2016-10-31 05:48:57 | lilydjwg | link | issue28565 messages |
2016-10-31 05:48:56 | lilydjwg | create | |
|