MATLAB Answers

ASONG ZILEFAC

Convert Serial numbers to conventional date

Asked by ASONG ZILEFAC
on 4 Nov 2012
 Hi,

I would like to convert these serial number 17067072 to conventional date such as mm-dd-yyyy.

I have a column vector of such dates to convert. I downloaded data in netCDF format, converted to ASCII and now have to convert the dates for easy interpretation.

I could convert using 'datestr' but my dates have 8 values as above.

I appreciate your effort.

Thanks.

  1 Comment

ASONG ZILEFAC
on 4 Nov 2012

The data I downloaded is on a daily basis and spans between 1948 to 2011 on a daily timescale.

Products

No products are associated with this question.

2 Answers

Answer by Walter Roberson
on 4 Nov 2012
 Accepted answer

datestr() can handle column vectors of serial date numbers.

  0 Comments


Answer by per isakson
on 4 Nov 2012
Edited by per isakson
on 5 Nov 2012

NetCDF files are supposed to be self-documented. Is it "serial hour numbers"?

    >> datestr( 17067072, 31 )
    ans =
    6728-01-21 00:00:00
    >> datestr( 17067072/24, 31 )
    ans =
    1947-01-01 00:00:00

  2 Comments

ASONG ZILEFAC
on 5 Nov 2012

Hi Per,

It works well for this case. What if I have a column vector?

Thank so much.

Walter Roberson
on 5 Nov 2012

Try it and see.


Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply today