Horje
unix to date python Code Example
unix to date python
>>> from datetime import datetime
>>> ts = int("1284101485")

# if you encounter a "year is out of range" error the timestamp
# may be in milliseconds, try `ts /= 1000` in that case
>>> print(datetime.utcfromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S'))
#'%Y' will be replaced by the year '%m' by the month '%d; by the day and so on 
#You move these how you want in the string, other characters will be ignored!
... '2010-09-10 06:51:25'
python datetime to unix timestamp
from datetime import datetime, timedelta
import time
dtime = datetime.now() + timedelta(seconds=3)
unixtime = time.mktime(dtime.timetuple())




Python

Related
esp32 micropython timer Code Example esp32 micropython timer Code Example
accuracy score sklearn syntax Code Example accuracy score sklearn syntax Code Example
WKUP2 in stm32 microcontroller Code Example WKUP2 in stm32 microcontroller Code Example
pyspark convert float results to integer replace Code Example pyspark convert float results to integer replace Code Example
conda install dash Code Example conda install dash Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7