The land area of China is 60-degree longitude from west to east.
According to the demarcation of the world time zoning standard,
the land area of China lies between the eastern fifth to ninth time
zones, there are 5 time zones in china in fact.
Currently, all the places in China have adopted the eastern eighth time
zone for the sake of convenience. It is the so-called “/Beijing Time/”.
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.
Timezone time : If location A is belong to timezone X, the time of
timezone X is the location A 's timezone time.
For Urumqi,localtime is the time of east 8 timezone, but timezone time
is the time of east 6 timezone.
How can I get the timezone time of urumqi with python code?
|from datetime import datetime, timedelta
from pytz import timezone
import pytz
tz = pytz.timezone('Asia/Urumqi')
dt= tz.localize(datetime(2002, 10, 27, 6, 0, 0))
fmt = '%Y-%m-%d %H:%M:%S %Z%z'
print(dt.strftime(fmt))
2002-10-27 06:00:00 CST+0800
|
It is a wrong answer,the timezone time is 2002-10-27 04:00:00 +0600
.|2002-10-27 06:00:00 CST+0800| is the localtime for Urumiq(by law in
china).
--
https://mail.python.org/mailman/listinfo/python-list