import time import datetime def conv_time_struct_time_to_datetime(struct_time): return datetime.datetime(*struct_time[:6]) today = time.localtime() print today print conv_time_struct_time_to_datetime(today)
実行結果
time.struct_time(tm_year=2010, tm_mon=9, tm_mday=19, tm_hour=12, tm_min=49, tm_sec=50, tm_wday=6, tm_yday=262, tm_isdst=0) 2010-09-19 12:49:50
こんなんでよいのかな?