def get_time_stamp(ct):
    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
print(get_time_stamp(1546244983.3656037))

输出

2018-12-31 16:30:05:069

 

 

或者

import datetime
 
print(datetime.datetime.now()) 
print(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S:%f'))
print(datetime.datetime.now().strftime('%Y%m%d%H%M%S%f'))

 

相关文章:

  • 2021-10-08
  • 2022-12-23
  • 2022-12-23
  • 2021-12-02
  • 2022-12-23
  • 2022-12-23
  • 2021-07-18
猜你喜欢
  • 2022-02-18
  • 2022-12-23
  • 2021-12-18
  • 2021-11-25
  • 2022-01-26
相关资源
相似解决方案