how to convert time in its standard form to seconds?

7 views (last 30 days)
Hi Team,
I have time in its standard format Hh:mm.ss loaded from excel sheet. how can i convert it into complete seconds which helps me in further calculation.

Accepted Answer

Mischa Kim
Mischa Kim on 10 Mar 2014
Edited: Mischa Kim on 10 Mar 2014
Use datenum.
t1 = '12:45:07';
t2 = '13:45:07';
dt_sec = round((datenum(t2,'HH:MM:SS') - datenum(t1,'HH:MM:SS'))*(24*3600))
dt_sec =
3600
  4 Comments
Radhika
Radhika on 18 Mar 2014
Hi Kim,
Can i consider millisecond in above format??

Sign in to comment.

More Answers (0)

Categories

Find more on Data Type Conversion in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!