php有一个非常有magic的函数,strtotime
可以把一个str的format的时间格式转化为mktime。
python里面没有,不过可以通过如下手段进行转化。
from time import mktime,strptime def testTime(): modified = int(mktime(strptime('2009-07-12 16:29:09','%Y-%m-%d %H:%M:%S'))) return modified
python strtotimephp有一个非常有magic的函数,strtotime 可以把一个str的format的时间格式转化为mktime。 python里面没有,不过可以通过如下手段进行转化。 from time import mktime,strptime def testTime(): modified = int(mktime(strptime('2009-07-12 16:29:09','%Y-%m-%d %H:%M:%S'))) return modified |
|