converting a date column with yyyymmdd to matlab date number?
Show older comments
Hi ,
I have a double(not a string)column where each observation is a number with the following format yyyymmdd.How can I convert this column to a column of matlab date numbers. for example, how can I convert 19960530 to 729175
Accepted Answer
More Answers (1)
Peter Perkins
on 14 May 2018
Danielle, you may have your reasons for wanting a datenum, but I'd suggest using datetime, for which there's an easy conversion:
>> datetime([19960530;19960531],'ConvertFrom','yyyymmdd')
ans =
2×1 datetime array
30-May-1996 00:00:00
31-May-1996 00:00:00
Categories
Find more on Time Series Objects 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!