timeseries date data matlab

3 views (last 30 days)
Sarah Yun
Sarah Yun on 10 Dec 2019
Answered: dpb on 10 Dec 2019
Hi,
I have a textfile for date (years from 1990 to 2015) and temp.
The dates in the date column are given in the following format:
727168
727199
727230
727258
727289
727319
727350
Why are the dates written like this and how can I convert them to standard dates in terms of days, months and years (if applicable)?
Thanks

Accepted Answer

dpb
dpb on 10 Dec 2019
Either however you created the text file and/or imported it, you ended up with the datenum integer portion of the date/time information (presuming there was time also originally). We'd have to know the rest of the process to be able to help regarding avoiding that.
But, given where you are, just convert the datenum to datetime via
>> t=[727168
727199
727230
727258
727289
727319
727350];
>> datetime(t,'ConvertFrom','datenum')
ans =
7×1 datetime array
01-Dec-1990 00:00:00
01-Jan-1991 00:00:00
01-Feb-1991 00:00:00
01-Mar-1991 00:00:00
01-Apr-1991 00:00:00
01-May-1991 00:00:00
01-Jun-1991 00:00:00
>>

More Answers (0)

Categories

Find more on Dates and Time 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!