# -*- coding: utf-8 -*- import time #元になる時刻はこのふたつ。 st_t1=u'2007/3/15 19:25:00' st_t2=u'07/3/15 20:29:03' #文字列を時刻を表すタプルに変換。 tap_t1=time.strptime(st_t1,'%Y/%m/%d %H:%M:%S') tap_t2=time.strptime(st_t2,'%y/%m/%d %H:%M:%S') print tap_t1,tap_t2 #時刻を表すタプルからエポック #(私のpc環境の場合。1970年1月1日00:00:00からの秒数。) #に変換。 epo_t1=time.mktime(tap_t1) epo_t2=time.mktime(tap_t2) print epo_t1,epo_t2 #2つの時刻の差を求める。 print epo_t2-e

