python timedelta to seconds

python timedelta to seconds

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import numpy as np 
import datetime

today = np.datetime64(datetime.datetime.today())
today
# numpy.datetime64('2018-07-12T19:28:08.889374')

past = np.datetime64('2018-07-11')
past
# numpy.datetime64('2018-07-11')

dif = today - past
dif
# numpy.timedelta64(156488889374,'us')

dif.astype(int)
# 1870066718

more on searchfor.space