How to subtract time in million second precision?
Show older comments
I have 2 table arrays of date(1st column) and time (2nd column) and I would like to check the time difference. Could you kindly advise?
My second values are in million second precision, e.g., 11:34:08.471810 and 11.34.06.471840 (as attached picture) How may I go about getting the time difference? I understand some of MATLAB function has limitation till millisecond. Have tried a few stuff (datevec, datenum, etc.) but not getting the precise results.
Thank you.
Accepted Answer
More Answers (1)
Peter Perkins
on 24 Jul 2017
It might also be worth noting that since you already have the time as a separate thing, you can also do this:
>> t1 = duration(11,34,08,471.810,'Format','hh:mm:ss.SSSSSS')
t1 =
duration
11:34:08.471810
>> t2 = duration(11,34,06,471.840,'Format','hh:mm:ss.SSSSSS')
t2 =
duration
11:34:06.471840
>> t1 - t2
ans =
duration
00:00:01.999969
Categories
Find more on Dates and Time in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!