MATLAB Answers

Changing gregorian date number to calendar date and time

30 views (last 30 days)
Arun Nair
Arun Nair on 6 Dec 2019
Commented: Arun Nair on 6 Dec 2019
I have an 18 years monthly data, whose 'time' variable is in gregorian calender. How do I change this to YYYY-MM format
More details about the variable:
units = hours since 1900-01-01 00:00:00.0
long_name = time
calendar = gregorian
For reference this is what time(1) looks like
>> time(1)
ans =


Sign in to comment.

Accepted Answer

Akira Agata
Akira Agata on 6 Dec 2019
If your time vector represents hours since 1900-01-01 00:00:00.0 , following code can convert it into yyyy-MM-dd.
T = datetime(1900,1,1) + hours(time);
T.Format = 'yyyy-MM-dd';

More Answers (0)

Sign in to answer this question.