How to convert time column to from HH:MM:SS to minutes and seconds?
    21 views (last 30 days)
  
       Show older comments
    
    Arshey Dhangekar
 on 1 Sep 2021
  
    
    
    
    
    Commented: Arshey Dhangekar
 on 1 Sep 2021
            I have a doubt , I want to convert Time column ( HH:MM:SS)  to min, there is a direct command time2num but it requires toolbox and it's paid.So without using time2num how can I convert into minutes. I tried with datetime also but I got error.
table=readtable('sample.csv'):
times = datetime(table.Time,'InputFormat','HH:mm:ss:SSS');
times = hour(times).*60 + minute(times) + second(times)./60; 
0 Comments
Accepted Answer
  Chunru
      
      
 on 1 Sep 2021
        % table=readtable('sample.csv'):
A=readtable('sample.csv')       % table is a function name in matlab
class(A.Time)       % A.Time is duration and it is not the time 
%times = datetime(A.Time,'InputFormat','HH:mm:ss:SSS')
% times = hour(times).*60 + minute(times) + second(times)./60; 
% you are finding minutes from A.Time
t_minutes = minutes(A.Time)
More Answers (0)
See Also
Categories
				Find more on Downloads 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!
