Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #93380
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed7.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.043 |
| X-Spam-Evidence | '*H*': 0.91; '*S*': 0.00; 'url:sourceforge': 0.03; 'dst': 0.07; 'boundaries.': 0.09; 'python': 0.11; 'appropriate': 0.14; 'wed,': 0.15; '2.7.3': 0.16; 'instead:': 0.16; 'offsets': 0.16; 'utc.': 0.16; 'wrote:': 0.16; '>>>': 0.20; 'am,': 0.23; '2015': 0.23; 'tried': 0.24; 'import': 0.24; 'header:In-Reply- To:1': 0.24; 'second': 0.24; 'chris': 0.26; 'message- id:@mail.gmail.com': 0.28; "we're": 0.30; 'maybe': 0.31; 'supposed': 0.31; "can't": 0.32; 'skip:p 30': 0.32; 'pacific': 0.33; 'case,': 0.34; 'received:google.com': 0.34; 'wrong': 0.35; 'to:addr:python-list': 0.35; 'something': 0.35; 'but': 0.36; 'should': 0.37; 'subject:: ': 0.37; '12,': 0.37; 'version': 0.38; 'skip:p 20': 0.38; 'to:addr:python.org': 0.39; 'easily': 0.39; 'subject:-': 0.39; 'skip:t 20': 0.40; 'subject: (': 0.40; 'your': 0.60; 'simple': 0.61; 'show': 0.62; 'mar': 0.65; 'hour': 0.69; 'jul': 0.72; 'saw': 0.76; '+1000,': 0.84; 'converter,': 0.84; 'to:name:python': 0.84; '2014,': 0.91 |
| 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=go/a9/zp0Qc0BCb6R4ZGBRnSG/Ud16vdl7/ZWfqfBSI=; b=c3h2WA8fmJz/iOp+0HJQkC8RU/0inTyKlskoojJiPnYnhOZ8yhAANgLHxiB2ywUo7V dHWGefRLcaZz5su7QMzRDgkx6vnq6AqlgBkFBxpqj+C9TAuIXYnXTwCNd0rT85hixeZ0 Nuwc4yjyRPBkxMyjxx8y3DWBHX4i4pzkzI7MGXw9zwieC/N0TPj2eTX9JXUnTG2rg7xU QLDlxl3BWjvf022WjM89tk9zU4I++e9FVG6yGv7M9TwLE6Qh5gAIJ/HVxr3MtFazPYfA 5UKB9Kc4lRe8NRzFazHdQMf0Qo1+dccuWJud/IU2lPEmWt2PX0JVz68Vild++pU1WtxL AE/Q== |
| X-Received | by 10.129.94.7 with SMTP id s7mr34083366ywb.111.1435769742261; Wed, 01 Jul 2015 09:55:42 -0700 (PDT) |
| MIME-Version | 1.0 |
| In-Reply-To | <cvij86Fnb08U1@mid.individual.net> |
| References | <cve7ppFk1viU1@mid.individual.net> <cvhdcpFdnliU1@mid.individual.net> <mailman.207.1435734941.3674.python-list@python.org> <cvij86Fnb08U1@mid.individual.net> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Wed, 1 Jul 2015 10:55:02 -0600 |
| Subject | Re: Datetime timezone trouble (was: Matplotlib X-axis timezone trouble) |
| To | Python <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| 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.222.1435769750.3674.python-list@python.org> (permalink) |
| Lines | 35 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1435769750 news.xs4all.nl 2837 [2001:888:2000:d::a6]:38901 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:93380 |
Show key headers only | View raw
On Wed, Jul 1, 2015 at 10:36 AM, Peter Pearson
<pkpearson@nowhere.invalid> wrote:
> On Wed, 1 Jul 2015 17:15:38 +1000, Chris Angelico <rosuav@gmail.com> wrote:
>>
>> Interestingly, when I tried this (pytz version 2015.4, Python 2.7.9,
>> Debian Jessie), I saw utcoffset() showing (-1, 58020) for both. That
>> seems... odd. And I can't fault your dates - those definitely ought to
>> be easily inside and easily outside the DST boundaries. When I try
>> those dates in an unrelated time converter, they do show seven- and
>> eight- hour offsets to UTC. Maybe we're both misunderstanding the
>> meaning of utcoffset()?
>
> Here's a very simple demonstration that either something is wrong
> or I don't understand how datetime and tzinfo are supposed to work:
>
> $ python
> Python 2.7.3 (default, Mar 13 2014, 11:03:55)
>>>> from pytz import timezone
>>>> from datetime import datetime
>>>> pacific = timezone("US/Pacific")
>>>> print(datetime(2014, 7, 7, 12, tzinfo=pacific))
> 2014-07-07 12:00:00-08:00
>>>> print(datetime(2014, 1, 7, 12, tzinfo=pacific))
> 2014-01-07 12:00:00-08:00
>>>>
>
> The "-08:00" is appropriate in the second (January) case, but the
> first case is in July, and should have "-07:00".
Use this instead:
>>> print(pacific.localize(datetime(2014, 7, 7, 12)))
2014-07-07 12:00:00-07:00
See http://pytz.sourceforge.net/#localized-times-and-date-arithmetic
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Matplotlib X-axis timezone trouble Peter Pearson <pkpearson@nowhere.invalid> - 2015-06-30 00:56 +0000
Re: Matplotlib X-axis timezone trouble Laura Creighton <lac@openend.se> - 2015-06-30 04:03 +0200
Re: Matplotlib X-axis timezone trouble Peter Pearson <pkpearson@nowhere.invalid> - 2015-06-30 04:57 +0000
Re: Matplotlib X-axis timezone trouble Chris Angelico <rosuav@gmail.com> - 2015-06-30 12:11 +1000
Re: Matplotlib X-axis timezone trouble Peter Pearson <pkpearson@nowhere.invalid> - 2015-06-30 04:49 +0000
Re: Matplotlib X-axis timezone trouble Chris Angelico <rosuav@gmail.com> - 2015-06-30 17:01 +1000
Re: Matplotlib X-axis timezone trouble Peter Pearson <pkpearson@nowhere.invalid> - 2015-06-30 16:42 +0000
Re: Matplotlib X-axis timezone trouble Chris Angelico <rosuav@gmail.com> - 2015-07-01 02:55 +1000
Re: Matplotlib X-axis timezone trouble Peter Pearson <pkpearson@nowhere.invalid> - 2015-07-01 05:50 +0000
Re: Matplotlib X-axis timezone trouble Chris Angelico <rosuav@gmail.com> - 2015-07-01 17:15 +1000
Datetime timezone trouble (was: Matplotlib X-axis timezone trouble) Peter Pearson <pkpearson@nowhere.invalid> - 2015-07-01 16:36 +0000
Re: Datetime timezone trouble (was: Matplotlib X-axis timezone trouble) Ian Kelly <ian.g.kelly@gmail.com> - 2015-07-01 10:55 -0600
Re: Datetime timezone trouble (was: Matplotlib X-axis timezone trouble) Peter Pearson <pkpearson@nowhere.invalid> - 2015-07-01 19:09 +0000
Re: Datetime timezone trouble (was: Matplotlib X-axis timezone trouble) Chris Angelico <rosuav@gmail.com> - 2015-07-02 03:08 +1000
Re: Matplotlib X-axis timezone trouble Akira Li <4kir4.1i@gmail.com> - 2015-07-04 07:29 +0300
Re: Matplotlib X-axis timezone trouble [SOLVED] Peter Pearson <pkpearson@nowhere.invalid> - 2015-07-04 17:37 +0000
Re: Matplotlib X-axis timezone trouble Tony the Tiger <tony@tiger.invalid> - 2015-07-09 19:50 +0000
Re: Matplotlib X-axis timezone trouble Peter Pearson <pkpearson@nowhere.invalid> - 2015-07-10 16:15 +0000
csiph-web