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


Groups > comp.lang.python > #76621

Re: How to look up historical time zones by date and location

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <cameron@cskk.homeip.net>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.007
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'url:sourceforge': 0.03; 'back.': 0.09; 'preferable': 0.09; 'seemed': 0.09; 'subject:How': 0.10; 'cc:addr:python-list': 0.11; 'python': 0.11; 'ah,': 0.16; 'attributes.': 0.16; 'believes': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'message-id:@cskk.homeip.net': 0.16; 'received:211.29': 0.16; 'received:211.29.132': 0.16; 'received:cskk.homeip.net': 0.16; 'received:homeip.net': 0.16; 'received:optusnet.com.au': 0.16; 'received:syd.optusnet.com.au': 0.16; 'simpson': 0.16; 'wrote:': 0.18; 'module': 0.19; 'pieces': 0.19; 'not,': 0.20; 'seems': 0.21; 'example': 0.22; 'cc:addr:python.org': 0.22; 'header:User- Agent:1': 0.23; 'string,': 0.24; 'cheers,': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'skip:p 30': 0.29; 'code': 0.31; '>>>>': 0.31; 'context.': 0.31; 'extract': 0.31; 'object.': 0.31; 'ok.': 0.31; 'prints': 0.31; 'subject:time': 0.33; 'could': 0.34; 'point.': 0.35; 'but': 0.35; 'there': 0.35; 'received:com.au': 0.36; 'skip:> 10': 0.36; "didn't": 0.36; 'charset:us-ascii': 0.36; 'remote': 0.38; 'received:211': 0.38; 'either': 0.39; 'how': 0.40; 'helps': 0.61; 'here:': 0.62; 'back': 0.62; 'content-disposition:inline': 0.62; 'information': 0.63; 'dear': 0.65; 'thomas': 0.65; 'to:addr:gmail.com': 0.65; 'natural': 0.68; 'yes': 0.68; 'truth': 0.81; 'friends': 0.81; 'beijing': 0.84; 'subject:location': 0.84; ',please': 0.91; 'error;': 0.91
Date Wed, 20 Aug 2014 09:14:36 +1000
From Cameron Simpson <cs@zip.com.au>
To luofeiyu <elearn2014@gmail.com>
Subject Re: How to look up historical time zones by date and location
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii; format=flowed
Content-Disposition inline
In-Reply-To <53F2A8E2.9000804@gmail.com>
User-Agent Mutt/1.5.21 (2010-09-15)
References <53F2A8E2.9000804@gmail.com>
X-Optus-CM-Score 0
X-Optus-CM-Analysis v=2.1 cv=AOuw8Gd4 c=1 sm=1 tr=0 a=YuQlxtEQCowy2cfE5kc7TA==:117 a=YuQlxtEQCowy2cfE5kc7TA==:17 a=ZtCCktOnAAAA:8 a=PO7r1zJSAAAA:8 a=LcaDllckn3IA:10 a=RTLq5RPPO3oA:10 a=MHYWykTb9eoA:10 a=kj9zAlcOel0A:10 a=vrnE16BAAAAA:8 a=pGLkceISAAAA:8 a=FP58Ms26AAAA:8 a=E-8CnAUwFBl_vAv-dUcA:9 a=CjuIK1q_8ugA:10 a=MSl-tDqOz04A:10
Cc python-list@python.org
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.13178.1408490080.18130.python-list@python.org> (permalink)
Lines 39
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1408490080 news.xs4all.nl 2884 [2001:888:2000:d::a6]:59600
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:76621

Show key headers only | View raw


On 19Aug2014 09:31, luofeiyu <elearn2014@gmail.com> wrote:
>My dear  friends here, all i want is get   ` LMT+8:06:00`  from the 
>output of tz1  `<DstTzInfo 'Asia/Shanghai' LMT+8:06:00 STD>`
>
>Shall we get back to the main point?

That didn't seem to be your main point. You seemed to want to get Asia/Urumqi 
time by either natural longituide or by Beijing Time, depending on context.

>If you are interested in it ,please say yes or no ,and how to do that ?
>
>import pytz,datetime
>tz1 = pytz.timezone('Asia/Shanghai')
>tz1
><DstTzInfo 'Asia/Shanghai' LMT+8:06:00 STD>
>>>> str(tz1)
>'Asia/Shanghai'

Ah, ok. The Python interperter prints repr(tz1), not str(tz1).

You could extract it from that string, but it would be better to get it from 
the object attributes.

I don't have the pytz module to hand; there seems to be good documentation 
here:

   http://pytz.sourceforge.net/

including example code to get various specific pieces of information out of a 
DstTzInfo object.

Please see if that helps you, and if not, come back.

Cheers,
Cameron Simpson <cs@zip.com.au>

Ignorance is preferable to error; and he is less remote from the truth
who believes nothing, than he who believes what is wrong.
         - Thomas Jefferson

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: How to look up historical time zones by date and location Cameron Simpson <cs@zip.com.au> - 2014-08-20 09:14 +1000

csiph-web