Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #76349
| References | <53ED6F6F.2030004@gmail.com> <CALwzid=0_EfOciS=vMuBrrrsqEncL+_gppETgCyQAXA5QbUdpg@mail.gmail.com> |
|---|---|
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | 2014-08-14 21:44 -0600 |
| Subject | Re: timedelta problem |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.13024.1408074339.18130.python-list@python.org> (permalink) |
[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)
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: timedelta problem Ian Kelly <ian.g.kelly@gmail.com> - 2014-08-14 21:44 -0600
csiph-web