How to get the seconds since epoch from the time + date output of gmtime()?

后端 未结 6 411
野性不改
野性不改 2020-12-02 07:14

How do you do reverse gmtime(), where you put the time + date and get the number of seconds?

I have strings like \'Jul 9, 2009 @ 20:02:58 UTC\'

6条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-02 07:36

    t = datetime.strptime('Jul 9, 2009 @ 20:02:58 UTC',"%b %d, %Y @ %H:%M:%S %Z")
    

提交回复
热议问题