MATLAB: Read date in NCD file

convert datesncd file

Dear all, I'm trying to extract the dates from NCD file where the date should start from 1st_january 1962 untill 31st_December 1962. However When I extract the date from the NCD file, I get these numbers (for example the first five days) 59169 59170 59171 59172 59173 and when tried to convert these numbers to a calender date I get these dates. 0161 12 30 0161 12 31 0162 01 01 0162 01 02 0162 01 03 I also checked the NCD file using the NCD viewer and I found that the dates are from 1st_January 1962, so there is nothing wrong with the NCD file, I just need to know how to convert these numbers to the exact date. Can anyone help me to convert these numbers to calendar dates starting from 1st_january 1962 please?
Thanks in advance

Best Answer

Add datenum('1800-1-1') to those 59169 59170 59171 59172 59173 to get the datenum representation in MATLAB. You can then datestr() them and so on.