Re: [Datetime-SIG] PEP 495 and the hardest problem in computer science
This is a social thread, right? On Wed, Jun 29, 2016 at 11:35 AM, Random832 <random832@fastmail.com> wrote:
On Wed, Jun 29, 2016, at 14:19, Alexander Belopolsky wrote:
I don't think you are correct. With the current Github implementation [1] of the PEP, I can do the following:
from datetime import * from test.datetimetester import ZoneInfo London = ZoneInfo.fromname('Europe/London') t0 = datetime(2016, 11, 6, 1, 30, fold=0) t1 = datetime(2016, 11, 6, 1, 30, fold=1) print(t0.astimezone(London)) 2016-11-06 05:30:00+00:00 print(t1.astimezone(London)) 2016-11-06 06:30:00+00:00
In the snippet above, t0 and t1 are "naive times that care about the 'fold'." (My system TZ is US/Eastern.) I am not sure what you mean by being portable, but I can convert either of those times to London Time using .astimezone() which assumes local timezone for naive instances.
Er, I was talking about using it as a naive time using the london timezone. Basically, the opposite of what you did: converting that naive time _from_ London time (you should be able to convert it from any timezone, after all, since it's naive) _to_ some other timezone. _______________________________________________ Datetime-SIG mailing list Datetime-SIG@python.org https://mail.python.org/mailman/listinfo/datetime-sig The PSF Code of Conduct applies to this mailing list: https://www.python.org/psf/codeofconduct/
-- --Guido van Rossum (python.org/~guido)
participants (1)
-
Guido van Rossum