0

How to convert a seconds series since 2012-01-01 0:0:0 to a time format expression.

And the inverse? Convert a time expression, such as 2015-6-23 10:00:00, to the seconds since 2012-01-01 0:0:0.

Roger Oliveira
  • 1,589
  • 1
  • 27
  • 55

1 Answers1

1
import datetime as dt

print (dt.datetime(2015,1,2) - dt.datetime(2015,1,1)).total_seconds()
print dt.datetime(2015,1,1) + dt.timedelta(seconds=3600*24)

the output

http://testedanswers.com/questions/-JsT943k5Y8lTp2dOb3s

Python documentation

https://docs.python.org/2/library/datetime.html

JuanPablo
  • 23,792
  • 39
  • 118
  • 164