LoginSignup
27
30

More than 5 years have passed since last update.

pythonのunix-time <-> datetime の変換

Posted at

unix-timeは1970年1月1日からの秒数
unix-time -> datetime

now=int()
datetime.datetime.fromtimestamp(now)

datetime->unix-time

now=datetime.datetime()
int(time.mktime(now.timetuple()))

27
30
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
27
30