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


Groups > comp.lang.python > #76445

How can I get the timezone time of a location?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin1!goblin2!goblin.stu.neva.ru!newsfeed1.swip.net!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <elearn2014@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status UNSURE 0.330
X-Spam-Level ***
X-Spam-Evidence '*H*': 0.46; '*S*': 0.12; 'adopted': 0.09; 'currently,': 0.09; 'sake': 0.09; 'used.': 0.09; 'subject:How': 0.10; 'python': 0.11; '0))': 0.16; 'code?': 0.16; 'import': 0.22; 'header:User-Agent:1': 0.23; 'lies': 0.31; 'so-called': 0.31; 'subject:time': 0.33; 'subject:the': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'belong': 0.36; 'east': 0.36; 'subject:?': 0.36; 'throughout': 0.37; 'wrong': 0.37; 'received:10': 0.37; 'area': 0.37; 'message-id:@gmail.com': 0.38; 'to:addr:python-list': 0.38; 'skip:. 10': 0.39; 'subject:can': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'according': 0.40; 'how': 0.40; 'skip:u 10': 0.60; 'places': 0.64; 'land': 0.65; 'world': 0.66; 'between': 0.67; 'eastern': 0.68; 'subject:get': 0.81; 'east.': 0.84; 'fact.': 0.84; 'longitude': 0.84; 'subject:location': 0.84; '|from': 0.84; 'divided': 0.91; 'ninth': 0.91; 'regions': 0.93; 'china': 0.97
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type; bh=pZZSvxCm7ggIu8WgdSLxIu/lt10uTUnqDmlkEBzd658=; b=c2vyJaN8UFjCOSP0E5tfd6C2zLCQ5ADWZlvVq/Ff2g7zkZm6KNsOys19nJin20GOhi FFODJtC4LiPRDSuUtzWhGfKMGxDjH77FDMmb7UrV0dJuBbGwOZ7C4xLir+f7yPrss9zl oWMM+vSzu7YzD3/YMJd5LjUgRMn1tI98icEieD71ldRvBubQYR1UQv4KXw3kvg7U9xry HoAtA30zZnfLhY0R0Akkx9TI5mbXNLLI9wwkSdIKt9u0pyDw3lw2OvAiFYJbCnzcrq4n CN1xiv6PL9r6eDypCx67qBCEyu1H4OrFQMZnLxjKi2x6ETGO7tbATpPkZzDKICQaiBRW pBfA==
X-Received by 10.68.194.229 with SMTP id hz5mr30281235pbc.91.1408321932515; Sun, 17 Aug 2014 17:32:12 -0700 (PDT)
Date Mon, 18 Aug 2014 08:31:45 +0800
From luofeiyu <elearn2014@gmail.com>
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.0
MIME-Version 1.0
To python-list@python.org
Subject How can I get the timezone time of a location?
Content-Type multipart/alternative; boundary="------------050008050004050503090302"
X-Mailman-Approved-At Mon, 18 Aug 2014 04:26:56 +0200
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.13077.1408328818.18130.python-list@python.org> (permalink)
Lines 88
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1408328818 news.xs4all.nl 2845 [2001:888:2000:d::a6]:52284
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:76445

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

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).

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


Thread

How can I get the timezone time of a location? luofeiyu <elearn2014@gmail.com> - 2014-08-18 08:31 +0800

csiph-web