"Sudip " <firstname.lastname@example.org> wrote in message news:email@example.com... > I am trying to convert NCEP 2 reanalysis dates to a matlab date format. > The time-series I am using from NCEP has a starting time : time(1)= > 1709328; > with a reference, 'hours since 1800-1-1 00:00:0.0 > (dj=datenum(1800,1,1))''. Matlab uses a different reference date which > is dm=datenum(1950,1,1) > when I use the date-shift (dm-dj) and try to use datestr to find the date > for time(1)=1709328, it gives me datestr(time(1)-dj+dm) > ans =23-Dec-4829----- which does not make sense.
From what you copied, it sounds like NCEP counts in hours: NCEP time 2 is one hour later than NCEP time 1.
MATLAB date numbers count in DAYS, not hours: MATLAB date number 2 is one DAY later than MATLAB date number 1.
> When I use ---datestr(time(1)+dj-dm) > > ans =24-Dec-4529---- it does not make sense too.
You're adding apples and oranges and expecting to obtain a pie. What you're getting instead is a smoothie. [Okay, not the greatest of metaphors.]
> Can anybody help to get the exact time for datenum=1709328
Convert the NCEP hours offset to a day offset and add to the NCEP base time.