How to calculate time elapsed (time in GMT format)

6 views (last 30 days)
I have below two different times, and want to calculate time elapsed:
Many thanks in advance,

Accepted Answer

Star Strider
Star Strider on 16 Dec 2017
One approach:
v = {'2017-12-13-T16:00:23.488+08:00'
T = datenum(v, 'yyyy-mm-dd-THH:MM:SS.FFF')
dT = etime(datevec(T(2)),datevec(T(1))) % Elapsed Time In Seconds
dT =
NOTE In theory, datetime can do something like this, however it will not import your data using the date format, and refuses to automatically recognise the time zone. I suppose datetime has its uses, but they frequently elude me. Anyway, the ‘classic’ functions work.

Sign in to comment.

More Answers (0)


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!