時刻変換
Python 標準ドキュメント 14.2 time -- 時刻データへのアクセスと変換
# -*- coding:utf-8 -*- import time # 日時を所定の書式で取得する fmt = "%a, %b %d, %Y %I:%M %p" time_str = time.strftime(fmt, time.localtime()) print time_str # 変換用の struct_time を取得する temp_time = time.strptime(time_str, fmt) # 所定の書式で変換する output_fmt = '%Y/%m/%d %H:%M:%S' print time.strftime(output_fmt, temp_time)
Trac Plugin 中で日付変換してるがなぜかうまくいってない