conversion of a date/time column into serial date number and seperate time column
Show older comments
I have a table in table format and it has 6 columns and 6 million rows.
The first column has dates and time in such a format '20050103 014800' which stands for 3rd January 2005 01:48:00.
I want the date of the first column to be converted into a date serial number which can be recognized by matlab (ie. via datenum). The time section I want to put into a seperate adjacent column in the format 00:00-->0, 00:01-->1 up until 23:59-->1439. can anyone help me? thanks
Accepted Answer
More Answers (2)
s = '20050103 014800';
dat = datenum([s(1:8)], 'yyyymmdd')
min = sscanf(s(10:11), '%f')*60 + sscanf(s(12:13), '%f')
AA
on 28 Oct 2015
0 votes
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!