1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| import time import datetime
def time_stamp1(): """ 时间戳 精确到毫秒,17位 :return: """ ct = time.time() local_time = time.localtime(ct) data_head = time.strftime("%Y%m%d%H%M%S", local_time) data_secs = (ct - int(ct)) * 1000 time_stamp = "%s%03d" % (data_head, data_secs) return time_stamp
|