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


Groups > comp.lang.python > #76337

Re: get the min date from a list

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.101
X-Spam-Level *
X-Spam-Evidence '*H*': 0.80; '*S*': 0.00; 'string.': 0.05; 'sys': 0.07; 'wrote:': 0.18; 'bit': 0.19; 'thu,': 0.19; 'import': 0.22; 'aug': 0.22; 'instead.': 0.24; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'subject:list': 0.30; 'message- id:@mail.gmail.com': 0.30; 'skip:( 20': 0.30; '>>>>': 0.31; 'libraries': 0.31; 'noted': 0.31; 'not.': 0.33; 'skip:d 20': 0.34; 'subject:the': 0.34; 'subject:from': 0.34; 'but': 0.35; 'received:google.com': 0.35; '14,': 0.36; 'adjust': 0.36; 'depends': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'previous': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'skip:t 30': 0.61; 'hear': 0.63; 'mar': 0.68; 'subject:get': 0.81; 'glad': 0.83; '2014,': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=LepMUbSDzrjYPGZ6sf2qNCrgiNd0j6l3fgMWPZUOOJ0=; b=M3oIEnVwmRemc+4tvO1Q6iBdh7hkn07MqmopWtZqMTjoPGG94y+bbl/wS4ob2cd2Ec TsV3vvK45k364BkKhRF8otutca+VeoGqo1wJsCQzv1ZHJPbNbpq7tMxb2B3fLnJjo36Q 2GrI2uiH1eZt6+UHmOZyNN+0vfQMz4Q0NS7VTm84BD+Ppd734bTzWnfNTT4J9rH7tyq1 uYOvi9xbxWVeaNMXMcX9EFl1fyL5sNCpticidN3M+89X+bC7x6m72x1jJZLDaphh4a0N b/5qozRU9MJf1EyC8vy77W33KrJBlfNk7xnMM1pPu+/zDBkbHCORYoAXLSa9DW9EVye7 7DQw==
X-Received by 10.66.90.229 with SMTP id bz5mr7577748pab.80.1408060700823; Thu, 14 Aug 2014 16:58:20 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <53ED44AD.605@gmail.com>
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 Thu, 14 Aug 2014 17:57:40 -0600
Subject Re: get the min date from a list
To Python <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.13013.1408060710.18130.python-list@python.org> (permalink)
Lines 29
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1408060710 news.xs4all.nl 2883 [2001:888:2000:d::a6]:44195
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:76337

Show key headers only | View raw


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


Thread

Re: get the min date from a list Ian Kelly <ian.g.kelly@gmail.com> - 2014-08-14 17:57 -0600

csiph-web