Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #76349 > unrolled thread

Re: timedelta problem

Started byIan Kelly <ian.g.kelly@gmail.com>
First post2014-08-14 21:44 -0600
Last post2014-08-14 21:44 -0600
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: timedelta problem Ian Kelly <ian.g.kelly@gmail.com> - 2014-08-14 21:44 -0600

#76349 — Re: timedelta problem

FromIan Kelly <ian.g.kelly@gmail.com>
Date2014-08-14 21:44 -0600
SubjectRe: timedelta problem
Message-ID<mailman.13024.1408074339.18130.python-list@python.org>

[Multipart message — attachments visible in raw view] — view raw

On Thu, Aug 14, 2014 at 9:37 PM, Ian Kelly <ian.g.kelly@gmail.com> wrote:
> On Thu, Aug 14, 2014 at 8:24 PM, luofeiyu <elearn2014@gmail.com> wrote:
> > t1 is GMT time   2014  00:36:46
> > t2 is GMT time   2014  14:36:46
>
> You have it backwards. t1 is a later time than t2.
>
> > datetime.datetime.strptime  do not give me the right answer.
>
> >>> dt1 - dt2
> datetime.timedelta(0, 50400)
> >>> _.seconds // 3600
> 14
>
> Looks correct to me.

Also:

>>> dt1.astimezone(datetime.timezone.utc)
datetime.datetime(2014, 8, 9, 14, 36, 46, tzinfo=datetime.timezone.utc)
>>> dt2.astimezone(datetime.timezone.utc)
datetime.datetime(2014, 8, 9, 0, 36, 46, tzinfo=datetime.timezone.utc)

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web