Home > Net >  How to convert a difference in timestamp to miliseconds?
How to convert a difference in timestamp to miliseconds?

Time:01-13

I have two dates in timestamp and their difference is

dt
0.006951093673706055

dt is: (1669983551.287477-1669983551.280526)

I want to generate several dates (in datetime) with that difference

Now normally I would do

date_list = [datetime.now()   datetime.timedelta(milliseconds=x) for x in range(n)]

but here timedelta uses the number of milliseconds.

So my question is how can I get the timestamp dt 0.006951093673706055 to miliseconds?

CodePudding user response:

A time in milliseconds is the time in seconds multiplied by 1000

dt = (1669983551.287477-1669983551.280526) # 0.006951 sec
dt_millisec = dt * 1000                    # 6.951 millisec
  • Related