Re: How to look up historical time zones by date and location
luofeiyu elearn2...@gmail.com writes: http://www.thefreedictionary.com/time+zone time zone Any of the 24 divisions of the Earth's surface used to determine the local time for any given locality. Each zone is roughly 15° of longitude in width, with local variations for economic and political convenience. Local time is one hour ahead for each time zone as one travels east and one hour behind for each time zone as one travels west. Urumqi 's localtime is beijin time ,it is decided by law . Urumqi 's timezone is east 6 ,it is decided by geography. There is only one localtime in all over the chian,beijin time,but there are 5 timezone time in china . In programming, a different timezone defintion is usually used [1] (pytz library provides access to the timezone database in Python). There are much more than 24 timezones (e.g., look at pytz.common_timezones) and a UTC offset used in a place may be unrelated to its longitude. A timezone is more a political entity than a geographical. [1] http://www.iana.org/time-zones For example, here's a shapefile for China [2]. It shows the shape of Asia/Chongqing, Asia/Harbin, Asia/Kashgar, Asia/Shanghai, Asia/Urumqi timezones on a map. [2] http://efele.net/maps/tz/china/ Different timezones may have the same UTC offset at some point. UTC offset for the same timezone may be different at different times e.g., due to DST transitions. There are multiple ways to get a timezone name from location [3]. [3] http://stackoverflow.com/questions/16505501/get-timezone-from-city-in-python-django -- Akira -- https://mail.python.org/mailman/listinfo/python-list
Re: How to look up historical time zones by date and location
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 ? -- https://mail.python.org/mailman/listinfo/python-list
Re: How to look up historical time zones by date and location
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' -- https://mail.python.org/mailman/listinfo/python-list
Re: How to look up historical time zones by date and location
On Mon, Aug 18, 2014 at 7:31 PM, luofeiyu elearn2...@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. -- https://mail.python.org/mailman/listinfo/python-list
Re: How to look up historical time zones by date and location
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, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list
Re: How to look up historical time zones by date and location
On 19Aug2014 09:31, luofeiyu elearn2...@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 c...@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 -- https://mail.python.org/mailman/listinfo/python-list
Re: How to look up historical time zones by date and location
tz1 DstTzInfo 'Asia/Shanghai' LMT+8:06:00 STD repr(tz1) DstTzInfo 'Asia/Shanghai' LMT+8:06:00 STD x=repr(tz1) x DstTzInfo 'Asia/Shanghai' LMT+8:06:00 STD import re re.search(LMT.+\s,x).group() 'LMT+8:06:00 ' i got it ,thinks to all my friends . -- https://mail.python.org/mailman/listinfo/python-list
Re: How to look up historical time zones by date and location
luofeiyu elearn2...@gmail.com writes: tz1 DstTzInfo 'Asia/Shanghai' LMT+8:06:00 STD repr(tz1) DstTzInfo 'Asia/Shanghai' LMT+8:06:00 STD Yes. Remember that ‘repr’ is for the benefit of the programmer, and there is no promise of what it contains. x=repr(tz1) x DstTzInfo 'Asia/Shanghai' LMT+8:06:00 STD import re re.search(LMT.+\s,x).group() 'LMT+8:06:00 ' This is wildly fragile. The ‘repr’ output depends on unpublished attributes: implementation details not part of the API which therefore can change without notice. You're then parsing a free-form string assuming that it will contain a structure for the data you want. All of those assumptions are subject to change without notification, and the result would be a bug in your code, not the library. At the least: Reduce the number of fragile links in that chain. If you want access to unpublished attributes, then simply access them directly. import pytz tz1 = pytz.timezone(Asia/Shanghai) (zone_name, tzname, utcoffset, is_dst) = (tz1.zone, tz1._tzname, tz1._utcoffset, tz1._dst) zone_name, tzname, utcoffset, is_dst ('Asia/Shanghai', 'CST', datetime.timedelta(0, 28800), datetime.timedelta(0)) Then use those values however you like. The values will still be subject to change without notice. But at least you'll avoid parsing structured data from a string, and you'll avoid whatever quirks go into the ‘repr’ output. -- \ “The difference between a moral man and a man of honor is that | `\ the latter regrets a discreditable act, even when it has worked | _o__) and he has not been caught.” —Henry L. Mencken | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list
Re: How to look up historical time zones by date and location
http://www.thefreedictionary.com/time+zone time zone Any of the 24 divisions of the Earth's surface used to determine the local time for any given locality. Each zone is roughly 15° of longitude in width, with local variations for economic and political convenience. Local time is one hour ahead for each time zone as one travels east and one hour behind for each time zone as one travels west. Urumqi 's localtime is beijin time ,it is decided by law . Urumqi 's timezone is east 6 ,it is decided by geography. There is only one localtime in all over the chian,beijin time,but there are 5 timezone time in china . you are totally wrong ,not me . -- https://mail.python.org/mailman/listinfo/python-list
Re: How to look up historical time zones by date and location
On Mon, Aug 18, 2014 at 2:55 PM, luofeiyu elearn2...@gmail.com wrote: http://www.thefreedictionary.com/time+zone time zone Any of the 24 divisions of the Earth's surface used to determine the local time for any given locality. Each zone is roughly 15° of longitude in width, with local variations for economic and political convenience. Local time is one hour ahead for each time zone as one travels east and one hour behind for each time zone as one travels west. Urumqi 's localtime is beijin time ,it is decided by law . Urumqi 's timezone is east 6 ,it is decided by geography. There is only one localtime in all over the chian,beijin time,but there are 5 timezone time in china . you are totally wrong ,not me . Fine, so you've just found a non-authoritative source that supports you. Congratulations. If you'd looked up Wikipedia, you'd have found a non-authoritative source that supports Ben. So I don't think your arrogance is justified here. Now, what has this to do with anything Python? You have quoted no context, so all we have is I'm right and you're wrong. Maybe if you actually explain what your Python problem is and how this affects it, we'll be better able to help you. Otherwise, you'll probably just get yourself plonked. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: How to look up historical time zones by date and location
luofeiyu elearn2...@gmail.com writes: http://www.thefreedictionary.com/time+zone time zone Any of the 24 divisions of the Earth's surface used to determine the local time for any given locality. Thanks, it's good to know there are dictionaries out there with incorrect definitions. That one is terrible and unhelpful. Urumqi 's localtime is beijin time ,it is decided by law . Urumqi 's timezone is east 6 ,it is decided by geography. Please use the standard definition of “time zone”, otherwise your terminology is only got to confuse the conversation. There is only one localtime in all over the chian,beijin time,but there are 5 timezone time in china . This just doesn't match the truth of standard time zones. You are free to think differently, but you will need to find a non-standard time zone database that agrees with you. you are totally wrong ,not me . You're free to keep on with that belief, but I'll only be providing information based on standard time zone definitions. If you choose to deviate from that, you're on your own. -- \ “The fundamental principle of science, the definition almost, | `\ is this: the sole test of the validity of any idea is | _o__) experiment.” —Richard P. Feynman | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list
Re: How to look up historical time zones by date and location
|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. -- https://mail.python.org/mailman/listinfo/python-list
Re: How to look up historical time zones by date and location
On Mon, Aug 18, 2014 at 9:12 AM, luofeiyu elearn2...@gmail.com wrote: I found that it is a concept LMT local mean time can express my meaning. Local Mean Time is time based on the actually astronomical position of the sun. It is defined as 12 noon when the sun is at its high point, directly south in the sky. This is the time you get when you read a sundial! So each town or village set their clocks differently. That all changed with the railroad industry. Once trains began traveling, time zones were invented so that everyone knew exactly what time it was in order to keep trains from meeting on the same tracks and colliding. Trains need time schedules. Time zones make this possible. Since the advent of time zones, you can be pretty well assured that the your LMT will be within a half hour or so (east or west) of the Time zone your location is assigned. But time zones are drawn for political reasons, and so that may not be precisely the case. In Indiana, USA there are (or were) several regions in different time zones. In the summer, they would change again, but not in step, so some places didn't switch to 'daylight savings time', and some did. Again, this had mostly to do with who the local business did business with, to keep time common for common trading partners. Off topic -- please remember to use plain text. 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. -- https://mail.python.org/mailman/listinfo/python-list -- Joel Goldstick http://joelgoldstick.com -- https://mail.python.org/mailman/listinfo/python-list
Re: How to look up historical time zones by date and location
On Mon, 18 Aug 2014 12:55:59 +0800, luofeiyu wrote: http://www.thefreedictionary.com/time+zone time zone Any of the 24 divisions of the Earth's surface used to determine the local time for any given locality. Each zone is roughly 15° of longitude in width, with local variations for economic and political convenience. Local time is one hour ahead for each time zone as one travels east and one hour behind for each time zone as one travels west. Urumqi 's localtime is beijin time ,it is decided by law . Urumqi 's timezone is east 6 ,it is decided by geography. There is only one localtime in all over the chian,beijin time,but there are 5 timezone time in china . you are totally wrong ,not me . The Oxford Dictionaries ( http://www.oxforddictionaries.com/definition/ english/zone?q=timezone#zone__8 ) definition of zone includes: (also time zone) A range of longitudes where a common standard time is used. freedictionary has a very broad definition of time zone and is probably slightly less authoritative on the definition of English words than the Oxford University Press. Most timezones may even be roughly 15 degrees in longitude in width, but this is not binding, and it is not unusual to find other widths applied. In the case of China, the Chinese government has determined that the whole country operates on Beijing Time, so the time zone *FOR ALL OF CHINA* is that of Beijing. The astronomical time[1] in Urumqi may not match the time zone, however the time zone is Beijing Time. [1] I consider astronomical noon for any point as being when the sun is at zenith, ie overhead of the longitude of the point[2]. [2] Yes, I realise this means that it's always noon, and midnight, and everything else at the poles, I just have to live with that. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list
Re: How to look up historical time zones by date and location
On Monday, August 18, 2014 7:21:53 PM UTC+5:30, Joel Goldstick wrote: On Mon, Aug 18, 2014 at 9:12 AM, luofeiyu wrote: I found that it is a concept LMT local mean time can express my meaning. Local Mean Time is time based on the actually astronomical position of the sun. It is defined as 12 noon when the sun is at its high point, directly south in the sky. This is the time you get when you read a sundial! So each town or village set their clocks differently. That all changed with the railroad industry. Once trains began traveling, time zones were invented so that everyone knew exactly what time it was in order to keep trains from meeting on the same tracks and colliding. Trains need time schedules. Time zones make this possible. Add to that the fact that any two places even say a kilometer apart, will have different LMT. Naturally if one chooses a least count, say 1 sec, then that distance will be larger. 40075 km equatorial circumference 86400 secs in a day (60×60×24) 40075/86400 = 2.1 ie LMT changes by 1 sec for every 2.1 km E-W along the equator And even here the distance would shrink going towards the poles. -- https://mail.python.org/mailman/listinfo/python-list
Re: How to look up historical time zones by date and location
On Mon, Aug 18, 2014 at 7:12 AM, luofeiyu elearn2...@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 -- https://mail.python.org/mailman/listinfo/python-list
Re: How to look up historical time zones by date and location
On Mon, Aug 18, 2014 at 11:53 AM, Ian Kelly ian.g.ke...@gmail.com wrote: On Mon, Aug 18, 2014 at 7:12 AM, luofeiyu elearn2...@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 Or if you really just want to work with the unofficial Xinjiang time, then I'd suggest simply constructing a datetime.timezone for UTC+6. -- https://mail.python.org/mailman/listinfo/python-list
Re: How to look up historical time zones by date and location
On 18 August 2014 20:03 Ian Kelly ian.g.ke...@gmail.com wrote: I also don't know why pytz shows the LMT offset in the repr for those timezones instead of the current UTC offset. If pytz objects do not have a datetime object attached, they default to the first ever entry, which is usually LMT. This can be problematic, as there are ways to attach a ~100 years ago time zone object to a 2014 date. -- Chris “Kwpolska” Warrick http://chriswarrick.com/ Sent from my SGS3. -- https://mail.python.org/mailman/listinfo/python-list
Re: How to look up historical time zones by date and location
Ian Kelly ian.g.ke...@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 -- https://mail.python.org/mailman/listinfo/python-list
Re: How to look up historical time zones by date and location
Joel Goldstick joel.goldst...@gmail.com writes: Local Mean Time is time based on the actually astronomical position of the sun. It is defined as 12 noon when the sun is at its high point, directly south in the sky. This is the time you get when you read a sundial! a sundial measures the Apparent Time, where the duration between two consecutive noons is different from 24*3600 s due to the variations in the Sun apparent angular velocity, that are originated by the Earth's orbit eccentricity and by the inclination of the Earth's rotation axis these variation are small but cumulative, so the AT can be fast or slow with respect to the LMT by as much as ±15' don't know if the same considerations apply also in Urumqi -- https://mail.python.org/mailman/listinfo/python-list
Re: How to look up historical time zones by date and location
On 2014-08-18, Ian Kelly ian.g.ke...@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 -- https://mail.python.org/mailman/listinfo/python-list
How to look up historical time zones by date and location (was: How can I get the timezone time of a location?)
luofeiyu elearn2...@gmail.com writes: I knew there is a difference between localtime and timezone time. Localtime: The official time in a local region (adjusted for location around the Earth); established by law or custom. Timezone: Any of the 24 regions of the globe (loosely divided by longitude) throughout which the same standard time is used. That is not what “time zone” means and you're going to continue being confused if you apply that definition. See the consensus definition at URL:https://en.wikipedia.org/wiki/Time_zone. For Urumqi,localtime is the time of east 8 timezone, but timezone time is the time of east 6 timezone. How have you determined these? Who declares “east 6” for Urumqi currently? Why should you expect a timezone database to contain that timezone for current time in that location. By the international time zone database, the time zone for Urumqi is currently “China Standard Time”, UTC+8 hours. That time zone is true for all dates since 1949 to the present day. Are you perhaps asking not about *current* time zone, but time zones at a different point in time? Historical time zones in China have differed URL:https://en.wikipedia.org/wiki/Historical_time_zones_of_China. Those historical time zones are in the standard time zone database, but only apply to specific date ranges. -- \“… no testimony can be admitted which is contrary to reason; | `\ reason is founded on the evidence of our senses.” —Percy Bysshe | _o__)Shelley, _The Necessity of Atheism_, 1811 | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list