[Datetime-SIG] The BDFL's take

Alexander Belopolsky alexander.belopolsky at gmail.com
Wed Jul 29 18:32:29 CEST 2015


On Wed, Jul 29, 2015 at 12:11 PM, Lennart Regebro <regebro at gmail.com> wrote:
> On Wed, Jul 29, 2015 at 5:50 PM, Alexander Belopolsky
> <alexander.belopolsky at gmail.com> wrote:
>> What do you see lacking in this solution?
>
> Btw: I pasted examples of the problems. That you can work around those
> in various ways do not change the fact that those problems remain. Do
> you have question about those examples?

When you insist on hammering nails with a pillow - don't be surprised when
you don't get the desired results.  And don't blame it on the pillow either -
it does what it is designed to do.  I am offering you a hammer and show
how to use it:

Problem: Find local time in New York one astronomical hour after
"2014-11-02T01:30-0400".

Solution:

>>> t = datetime.strptime("2014-11-02T01:30-0400", "%Y-%m-%dT%H:%M%z")
>>> u = (t+timedelta(hours=1))
>>> u.astimezone().strftime("%Y-%m-%dT%H:%M%z")
'2014-11-02T01:30-0500'

What do you want to improve here?


More information about the Datetime-SIG mailing list