On Wed, Jun 29, 2016 at 2:35 PM, Random832 <[email protected]> wrote:

> Er, I was talking about using it as a naive time using the london
> timezone.
>

Well, "a naive time using a timezone" is a misnomer.


> 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.
>

And you can:

>>> New_York = ZoneInfo.fromname('America/New_York')
>>> print(t0.replace(tzinfo=New_York).astimezone(timezone.utc))
2016-11-06 05:30:00+00:00
>>> print(t1.replace(tzinfo=New_York).astimezone(timezone.utc))
2016-11-06 06:30:00+00:00
>>> print(t0.replace(tzinfo=London).astimezone(timezone.utc))
2016-11-06 01:30:00+00:00
>>> print(t1.replace(tzinfo=London).astimezone(timezone.utc))
2016-11-06 01:30:00+00:00

Note that the result of conversion to UTC is different for t0 and t1 when
they are interpreted as NY times, but the same when they are interpreted as
London time.

I think this all has been explained in the PEP, but discussions like this
may be helpful for writing the documentation.
_______________________________________________
Datetime-SIG mailing list
[email protected]
https://mail.python.org/mailman/listinfo/datetime-sig
The PSF Code of Conduct applies to this mailing list: 
https://www.python.org/psf/codeofconduct/

Reply via email to