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


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

Re: get the min date from a list

Started byIan Kelly <ian.g.kelly@gmail.com>
First post2014-08-14 17:57 -0600
Last post2014-08-14 17:57 -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: get the min date from a list Ian Kelly <ian.g.kelly@gmail.com> - 2014-08-14 17:57 -0600

#76337 — Re: get the min date from a list

FromIan Kelly <ian.g.kelly@gmail.com>
Date2014-08-14 17:57 -0600
SubjectRe: get the min date from a list
Message-ID<mailman.13013.1408060710.18130.python-list@python.org>
On Thu, Aug 14, 2014 at 5:22 PM, luofeiyu <elearn2014@gmail.com> wrote:
> I am glad to hear that it is no necessary to create a complicated my
> function to change the time string.
> But in my computer the timezone offset  do not work for me.
> I am in win7+python34.
>
>>>> import sys
>>>> sys.version
> '3.4.0 (v3.4.0:04f714765c13, Mar 16 2014, 19:25:23) [MSC v.1600 64 bit
> (AMD64)]'
>
>>>> import time
>>>> time.tzname
> ('China Standard Time', 'China Daylight Time')
>>>> time.strptime(t1,"%a, %d %b %Y %H:%M:%S %z")
> time.struct_time(tm_year=2014, tm_mon=8, tm_mday=9, tm_hour=7, tm_min=36,
> tm_sec
> =46, tm_wday=5, tm_yday=221, tm_isdst=-1)
>>>> time.strptime(t2,"%a, %d %b %Y %H:%M:%S %z")
> time.struct_time(tm_year=2014, tm_mon=8, tm_mday=9, tm_hour=7, tm_min=36,
> tm_sec
> =46, tm_wday=5, tm_yday=221, tm_isdst=-1)
>>>>
>
> The %z does not work for me, how to adjust it my computer?

As I noted in my previous post, try using datetime.datetime.strptime
instead. The time.strptime function depends on the C libraries to
support it, while the datetime.strptime does not.

[toc] | [standalone]


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


csiph-web