Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to convert timestamp to date in python

from datetime import datetime
dt = datetime.strptime('2015-04-08T07:52:00Z', '%Y-%m-%dT%H:%M:%SZ')
print dt.strftime('%d/%m/%Y')

#------------------------------------------------------------------------

from datetime import datetime


timestamp = 1545730073
dt_obj = datetime.fromtimestamp(1140825600)

print("date_time:",dt_obj)
print("type of dt:",type(dt_obj))
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #convert #timestamp #date #python
ADD COMMENT
Topic
Name
3+6 =