Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #76337
| References | <53ECC35C.80608@gmail.com> <CALwzidmMPCdzwgfyBWst_qYyqsicBUM1_m6YB3FvT_PxniXo5g@mail.gmail.com> <53ED44AD.605@gmail.com> |
|---|---|
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | 2014-08-14 17:57 -0600 |
| Subject | Re: get the min date from a list |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.13013.1408060710.18130.python-list@python.org> (permalink) |
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.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: get the min date from a list Ian Kelly <ian.g.kelly@gmail.com> - 2014-08-14 17:57 -0600
csiph-web