How to convert current date to epoch timestamp?

前端 未结 9 2328
情话喂你
情话喂你 2020-12-14 05:41

How to convert current date to epoch timestamp ?

Format current date:

29.08.2011 11:05:02
9条回答
  •  鱼传尺愫
    2020-12-14 06:07

    Short-hand to convert python date/datetime to Epoch (without microseconds)

    int(current_date.strftime("%s")) # 2020-01-14  ---> 1578956400
    int(current_datetime.strftime("%s")) # 2020-01-14 16:59:30.251176 -----> 1579017570
    

提交回复
热议问题