Skip to Content
Python 技術手冊 第三版
book

Python 技術手冊 第三版

by lex Martelli, Anna Martelli Ravenscroft, Steve Holden
January 2018
Intermediate to advanced content levelIntermediate to advanced
856 pages
17h 17m
Chinese
GoTop Information, Inc.
Content preview from Python 技術手冊 第三版
dateutil 模組
|
421
timezone timezone(name)
回傳
tzinfo
的一個實體,對應名為
name
的時區。舉例來說,要
將紐約的 2005 12 31 日的子夜(midnight, December 31,
2005, in New York)印出為 Honolulu(檀香山)時區的時間,
就:
dt = datetime.datetime(2005,12,31,
tzinfo=pytz.timezone('America/New_York'))
print(dt.astimezone(
pytz.timezone('Pacific/Honolulu')))
# 出:2005-12-30 19:00:00-10:00
dateutil 模組
第三方套件
dateutil
http://labix.org/python-dateutil
,你可以用
pip install
python-dateutil
來安裝)提供的模組能以許多方式處理日期:time deltas
(時間增量)、recurrence(循環)、time zones(時區)、Easter dates(復
活節日期),以及 fuzzy parsing(模糊剖析)。(它豐富功能性的完整說明
文件請參閱套件的網站(
https://labix.org/python-dateutil
)。)
dateutil
的主
要模組有:
easter easter.easter(year)
為給定的
year
的復活節(Easter)回傳 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

測試驅動開發|使用 Python

測試驅動開發|使用 Python

Harry J.W. Percival
Linux 内核观测技术BPF

Linux 内核观测技术BPF

David Calavera, Lorenzo Fontana

Publisher Resources

ISBN: 9789864766819