-Python関係のWiki
--[[Python]]
--[[Python/MySQL]]
--[[Python/urllib]]
--[[Python/オブジェクト指向]]
--[[Python/外部プログラム実行]]
--[[Python/コマンドライン]]
--[[Python/コンテナ]]
--[[Python/ネットワーク]]
--[[Python/日付・時間]]
--[[Python/ファイル]]
--[[Python/メモリ]]
--[[Python/文字列]]
----
-[[datetime -- 基本的な日付型および時間型:http://www.python.jp/doc/2.4/lib/module-datetime.html]]
-[[文字列を日付、時刻を表すタプルに変換。時刻を表すタプルからエポックへ。そして、2つの日付、時刻の差を求める。:http://d.hatena.ne.jp/Cassiopeia/20070923/1190478920]]
-[[Epoch Converter:http://www.epochconverter.com/]] ... 様々なプログラミング言語の日付処理が載っている。オススメ!
-[[Date and Time Representation in Python:http://seehuhn.de/pages/pdate]]
* 日付とUnix Timeの相互変換 [#md14386b]
import time
:
time.mktime(2009, 10, 28, 0, 0, 0)
1256655600.0
time.localtime(1256655600)
time.struct_time(tm_year=2009, tm_mon=10, tm_mday=28, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=2, tm_yday=301, tm_isdst=0)
import datetime
:
dt = datetime.datetime.fromtimestamp(1256655600)
print dt.strftime('%Y%m%d')
20091028