how to find time difference between timestamps to a millisecond?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have two columns which contain timestamps in the format of yyyy-mm-dd
hh:mm:ss:msmsms (the last three digits are the milliseconds). I need to find
the difference of the timestamps in ss:msmsms format.

I am trying to implement a VB function to do this as there is no predefined
function available. Can anyone please assist?

Thanks!
 
If you have date/time in exactly that format (ie 05 for fifth month not just
5) then this formula will convert your data to Excel's date/time format
=DATE(LEFT(A1,4),MID(A1,6,2),MID(A1,9,2))+TIME(MID(A1,12,2),MID(A1,15,2),MID(A1,18,2))+RIGHT(A1,3)/1000/60/60/24
You will need to format the cell with yyyy/mm/dd hh:mm:ss.000
In my test I changed 2006-06-10 05:45:15:349 to 2006/06/10 05:45:15.349
To get difference, I used =ROUND((F2-F1)*24*60*60,3)
best wishes
 
Thank you!

Bernard Liengme said:
If you have date/time in exactly that format (ie 05 for fifth month not just
5) then this formula will convert your data to Excel's date/time format
=DATE(LEFT(A1,4),MID(A1,6,2),MID(A1,9,2))+TIME(MID(A1,12,2),MID(A1,15,2),MID(A1,18,2))+RIGHT(A1,3)/1000/60/60/24
You will need to format the cell with yyyy/mm/dd hh:mm:ss.000
In my test I changed 2006-06-10 05:45:15:349 to 2006/06/10 05:45:15.349
To get difference, I used =ROUND((F2-F1)*24*60*60,3)
best wishes
 
Back
Top