Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #76499 > unrolled thread
| Started by | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| First post | 2014-08-18 11:53 -0600 |
| Last post | 2014-08-19 17:44 +0000 |
| Articles | 7 — 5 participants |
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 Ian Kelly <ian.g.kelly@gmail.com> - 2014-08-18 11:53 -0600
Re: How to look up historical time zones by date and location pecore@pascolo.net - 2014-08-18 21:47 +0200
Re: How to look up historical time zones by date and location Grant Edwards <invalid@invalid.invalid> - 2014-08-18 21:14 +0000
Re: How to look up historical time zones by date and location luofeiyu <elearn2014@gmail.com> - 2014-08-19 09:31 +0800
Re: How to look up historical time zones by date and location luofeiyu <elearn2014@gmail.com> - 2014-08-19 09:00 +0800
Re: How to look up historical time zones by date and location Ian Kelly <ian.g.kelly@gmail.com> - 2014-08-19 10:25 -0600
Re: How to look up historical time zones by date and location Denis McMahon <denismfmcmahon@gmail.com> - 2014-08-19 17:44 +0000
| From | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| Date | 2014-08-18 11:53 -0600 |
| Subject | Re: How to look up historical time zones by date and location |
| Message-ID | <mailman.13107.1408384942.18130.python-list@python.org> |
On Mon, Aug 18, 2014 at 7:12 AM, luofeiyu <elearn2014@gmail.com> wrote:
>
> I found that it is a concept LMT local mean time can express my meaning.
>
> import pytz,datetime
> tz1 = pytz.timezone('Asia/Shanghai')
> tz1
> <DstTzInfo 'Asia/Shanghai' LMT+8:06:00 STD>
> >>> str(tz1)
> 'Asia/Shanghai'
>
> tz2 = pytz.timezone('Asia/Urumqi')
> tz2
> <DstTzInfo 'Asia/Urumqi' LMT+5:50:00 STD>
>
> the time difference between shanghai and Urumqi is about 2 hours in the form of LMT.
>
> now ,how can i get the output of `LMT+8:06:00` in <DstTzInfo 'Asia/Shanghai' LMT+8:06:00 STD>
>
> str(tz1) or str(tz2) can not do that.
By working with dates far enough in the past that the modern time zone
rules don't apply. Some experimentation determines that the timedelta
between Shanghai and Urumqi goes from 136 minutes to 120 minutes in
1928, and then from 120 minutes to 0 minutes in 1980. I don't know why
those dates don't match the dates given by Wikipedia in [1], and I
also don't know why pytz shows the LMT offset in the repr for those
timezones instead of the current UTC offset.
[1] http://en.wikipedia.org/wiki/Time_in_China
[toc] | [next] | [standalone]
| From | pecore@pascolo.net |
|---|---|
| Date | 2014-08-18 21:47 +0200 |
| Message-ID | <87fvgttwaq.fsf@pascolo.net> |
| In reply to | #76499 |
Ian Kelly <ian.g.kelly@gmail.com> writes:
> Some experimentation determines that the timedelta between Shanghai
> and Urumqi
Urumqi is on the way for the level of popularity that Piraeus enjoyed
in the good ol'days
--
per crimini come l'umanita'.
MMAX, in IPI+IHC
[toc] | [prev] | [next] | [standalone]
| From | Grant Edwards <invalid@invalid.invalid> |
|---|---|
| Date | 2014-08-18 21:14 +0000 |
| Message-ID | <lstqar$pg5$2@reader1.panix.com> |
| In reply to | #76499 |
On 2014-08-18, Ian Kelly <ian.g.kelly@gmail.com> wrote: > By working with dates far enough in the past that the modern time zone > rules don't apply. Some experimentation determines that the timedelta > between Shanghai and Urumqi goes from 136 minutes to 120 minutes in > 1928, and then from 120 minutes to 0 minutes in 1980. Thanks to politicians who keep mucking about with such things as a way to appear busy while still avoiding doing anything useful, it's no small feat to handle current timezones correctly. Expecting them to work for dates/times from long ago is pretty much beyond the pale. -- Grant
[toc] | [prev] | [next] | [standalone]
| From | luofeiyu <elearn2014@gmail.com> |
|---|---|
| Date | 2014-08-19 09:31 +0800 |
| Message-ID | <mailman.13130.1408428641.18130.python-list@python.org> |
| In reply to | #76515 |
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?
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'
[toc] | [prev] | [next] | [standalone]
| From | luofeiyu <elearn2014@gmail.com> |
|---|---|
| Date | 2014-08-19 09:00 +0800 |
| Message-ID | <mailman.13129.1408428641.18130.python-list@python.org> |
| In reply to | #76515 |
[Multipart message — attachments visible in raw view] — view raw
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? If you are interested in it ,please say yes or no ,and how to do that ?
[toc] | [prev] | [next] | [standalone]
| From | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| Date | 2014-08-19 10:25 -0600 |
| Message-ID | <mailman.13153.1408465604.18130.python-list@python.org> |
| In reply to | #76515 |
On Mon, Aug 18, 2014 at 7:31 PM, 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?
>
> 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'
This is not a supported use case, so there's no good way to do it that
I can see. What gets printed when you evaluate tz1 is the result of
calling repr(), not str().
>>> repr(tz1)
"<DstTzInfo 'Asia/Shanghai' LMT+8:06:00 STD>"
If you just want the "LMT+8:06:00" as a string, you could call
repr(tz1) and then parse the result with a regex. But like I said,
this is not something that is supported by pytz. Somebody else noted
that the repr is simply showing the first historical entry for the
timezone in the database. Since the first entry is somewhat arbitrary,
not all time zones will show LMT like this, and there is no guarantee
that it won't change in some future update of pytz. In fact, there is
an open bug to fix this behavior:
https://bugs.launchpad.net/pytz/+bug/1319939
We might be able to be more helpful if you would be more clear about
what problem it is that you are trying to solve. Are you trying, for a
given point on the Earth, to determine what nautical time zone it
falls into, or some other "natural" time zone, or its LMT offset, or
something else? For any of those cases, I think the Olson database of
*legal* time zones is not going to be very useful. It would probably
be better to obtain the longitude and do the calculation yourself.
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2014-08-19 17:44 +0000 |
| Message-ID | <lt02db$tmv$1@dont-email.me> |
| In reply to | #76574 |
On Tue, 19 Aug 2014 10:25:58 -0600, Ian Kelly wrote: > We might be able to be more helpful if you would be more clear about > what problem it is that you are trying to solve. Are you trying, for a > given point on the Earth, to determine what nautical time zone it falls > into, or some other "natural" time zone, or its LMT offset, or something > else? For any of those cases, I think the Olson database of *legal* time > zones is not going to be very useful. It would probably be better to > obtain the longitude and do the calculation yourself. Agreed, if OP wishes to insist that time is defined solely by longitude, then his best bet is to look up the longitude of the point in question on google maps and calculate his UTC time zone offset from that at 240 seconds of time per degree longitude. But Urumqi seems to be almost 83 seconds wide in astronomical time terms, so does he want West Urumqi time, Central Urumqi time or East Urumqi time? -- Denis McMahon, denismfmcmahon@gmail.com
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web