Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #76342
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <elearn2014@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.019 |
| X-Spam-Evidence | '*H*': 0.96; '*S*': 0.00; 'represents': 0.05; 'arguments': 0.09; 'integers': 0.09; 'negative.': 0.09; 'skip:/ 10': 0.09; 'python': 0.11; 'stored': 0.12; '36,': 0.16; '46,': 0.16; 'duration,': 0.16; 'optional': 0.16; '>>>': 0.22; 'import': 0.22; 'aug': 0.22; 'header:User-Agent:1': 0.23; '>>>': 0.24; 'days,': 0.24; 'subject:problem': 0.24; 'doc': 0.31; 'class': 0.32; 'url:python': 0.33; 'skip:d 20': 0.34; 'problem': 0.35; 'received:google.com': 0.35; 'dates': 0.36; 'url:org': 0.36; 'positive': 0.37; 'seconds': 0.37; 'two': 0.37; 'received:10': 0.37; 'message-id:@gmail.com': 0.38; 'url:library': 0.38; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'skip:t 30': 0.61; 'subject: ': 0.61; 'url:3': 0.61; 'between': 0.67; 'answer.': 0.68; 'default': 0.69; 'url:4': 0.69; 'internally.': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type; bh=5AQdTYRg7SBagAjxkpEUa1jXNj1NE330L8mouWYxBeQ=; b=bazk1tTONEGGkkPrYwU/lwWfdRruuL7yosd/T2HpxN8/APKfCoIpCR5DpwFFM7/JMC 1990a0dSCcsxs6MXU1QkNnYY8iGmfPnFa0pek27DT2mKTI7gPVrpJABDPF2qO41SY0Yf yswN/zZ4/aNSl4hnt/v4zUcmjbhRX6mMDwUQBgvsRVC8G9Zph/XnpOmrqZO17L7t/Bwx /5uIu89Y8C2WFi8DckAktGDADfQSt2HmltU8WiGXTyJP/0dSn4vaaBYAZvH8sbiFtmGy obHKk51O5pKM785ein2o3rrqQprJXSQGWQ3m76oJE9Wr32ypdLyY9hnJYrzRuO7qnUZ4 FlFg== |
| X-Received | by 10.66.65.195 with SMTP id z3mr8292935pas.116.1408069498645; Thu, 14 Aug 2014 19:24:58 -0700 (PDT) |
| Date | Fri, 15 Aug 2014 10:24:47 +0800 |
| From | luofeiyu <elearn2014@gmail.com> |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.0 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | timedelta problem |
| Content-Type | multipart/alternative; boundary="------------040908080309050000060902" |
| 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.13018.1408069502.18130.python-list@python.org> (permalink) |
| Lines | 100 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1408069502 news.xs4all.nl 2880 [2001:888:2000:d::a6]:41366 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:76342 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
In the python doc , https://docs.python.org/3.4/library/datetime.html
A timedelta
<https://docs.python.org/3.4/library/datetime.html#datetime.timedelta>
object represents a duration, the difference between two dates or times.
/class /datetime.timedelta(/days=0/, /seconds=0/, /microseconds=0/,
/milliseconds=0/, /minutes=0/, /hours=0/, /weeks=0/)
All arguments are optional and default to 0. Arguments may be
integers or floats, and may be positive or negative.
Only /days/, /seconds/ and /microseconds/ are stored internally.
import datetime
t1='Sat, 09 Aug 2014 07:36:46 -0700'
t2='Sat, 09 Aug 2014 07:36:46 +0700'
>>> datetime.datetime.strptime(t1,"%a, %d %b %Y %H:%M:%S %z")
datetime.datetime(2014, 8, 9, 7, 36, 46,
tzinfo=datetime.timezone(datetime.timed
elta(-1, 61200)))
>>> datetime.datetime.strptime(t2,"%a, %d %b %Y %H:%M:%S %z")
datetime.datetime(2014, 8, 9, 7, 36, 46,
tzinfo=datetime.timezone(datetime.timed
elta(0, 25200)))
problem :
t1 is GMT time 2014 00:36:46
t2 is GMT time 2014 14:36:46
datetime.datetime.strptime do not give me the right answer.
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
timedelta problem luofeiyu <elearn2014@gmail.com> - 2014-08-15 10:24 +0800
Re: timedelta problem Denis McMahon <denismfmcmahon@gmail.com> - 2014-08-15 03:51 +0000
Re: timedelta problem Chris Angelico <rosuav@gmail.com> - 2014-08-15 13:59 +1000
Re: timedelta problem Ian Kelly <ian.g.kelly@gmail.com> - 2014-08-14 22:00 -0600
Re: timedelta problem Denis McMahon <denismfmcmahon@gmail.com> - 2014-08-15 07:39 +0000
Re: timedelta problem Denis McMahon <denismfmcmahon@gmail.com> - 2014-08-15 08:44 +0000
Re: timedelta problem Ian Kelly <ian.g.kelly@gmail.com> - 2014-08-15 09:23 -0600
Re: timedelta problem Denis McMahon <denismfmcmahon@gmail.com> - 2014-08-15 17:43 +0000
Re: timedelta problem Ian Kelly <ian.g.kelly@gmail.com> - 2014-08-15 12:05 -0600
Re: timedelta problem Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-08-15 17:29 +0100
Re: timedelta problem Denis McMahon <denismfmcmahon@gmail.com> - 2014-08-15 09:36 +0000
csiph-web