Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #76621 > unrolled thread
| Started by | Cameron Simpson <cs@zip.com.au> |
|---|---|
| First post | 2014-08-20 09:14 +1000 |
| Last post | 2014-08-20 09:14 +1000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: How to look up historical time zones by date and location Cameron Simpson <cs@zip.com.au> - 2014-08-20 09:14 +1000
| From | Cameron Simpson <cs@zip.com.au> |
|---|---|
| Date | 2014-08-20 09:14 +1000 |
| Subject | Re: How to look up historical time zones by date and location |
| Message-ID | <mailman.13178.1408490080.18130.python-list@python.org> |
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 top | Article view | comp.lang.python
csiph-web