get the min date from a list

Ian Kelly ian.g.kelly at gmail.com
Thu Aug 14 19:57:40 EDT 2014


On Thu, Aug 14, 2014 at 5:22 PM, luofeiyu <elearn2014 at 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.



More information about the Python-list mailing list