python unix-time <-> datetime conversion

unix-time is the number of seconds since January 1, 1970 unix-time -> datetime

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

datetime->unix-time

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

Recommended Posts

python unix-time <-> datetime conversion
Conversion of string <-> date (date, datetime) in Python
[Python] 2's complement conversion
[Python2] Date string-> UnixTime-> Date string
About Python datetime and timezone
Image data type conversion [Python]
I made a class that easily performs unixtime ← → datetime conversion
Python QT app Standalone App conversion memo
python datetime format quick reference table
MP3 to WAV conversion with Python
Handling timezones in Python (datetime, pytz)
Python executable file conversion module comparison 2
Python UTC ⇔ JST, character string (UTC) ⇒ JST conversion memo
Comparison of Japanese conversion module in Python3
Python learning basics ~ What is type conversion? ~
Receive date type (datetime) with ArgumentParser [python]
python> datetime> get msec> msec = int (round (time.time () * 1000))% 1000
Python: Preprocessing in machine learning: Data conversion
Python> datetime> runtime arguments> start processing immediately
Algorithm learned with Python 3rd: Radix conversion
String → Bool value conversion in Python Consideration