MATLAB: Is this a matlab bug

datenumMATLAB

when i write like:
n = datenum('2017-06-12','yyyy-mm-dd',1900);
n = datenum('2017-06-12','yyyy-mm-dd',2000).
it return the same result.
the matlab version is r2013b.
what's the problem?

Best Answer

  • The pivot year is used in interpreting date strings that have the year specified as two characters. To see the difference, introduce the last two digits of your your year, otherwise, the use of pivotyear yields the same result.
    >> n1 = datenum('17-06-11','yy-mm-dd',1900)
    n1 =
    700332
    >> n2 = datenum('17-06-11','yy-mm-dd',2000)
    n2 =
    736857