MATLAB: Does “datestr” return wrong results when using date vectors inputs in MATLAB 8.2 (R2013b)

MATLAB

I am trying to use "datestr" in MATLAB 8.2 (R2013b) to convert my date vector into a date string, but I am getting incorrect results.  The following command works fine:
>> datestr([2014 250 200 1 1 1])
 
ans =
 
18-Apr-2035 01:01:01
If I then increase the day element to 250, I get the following incorrect results:
 
>> datestr([2014 250 250 1 1 1])
 
ans =
 
06-Jul-0005
06-Sep-0000
06-Sep-0000
01-Jan-0000
01-Jan-0000
01-Jan-0000
Why does "datestr" return a series of dates instead of the correct date? 

Best Answer

This is an expected behavior in MATLAB 8.2 (R2013b).  The reason "datestr" returns multiple dates is that this function is interpreting the input as a vector of serial dates instead of as a date vector.  The documentation for "datestr" states that this happens when any element of the date vector fall outside the range of expected values from the current date.  
To work around this behavior, first convert the date vector to a serial date using "datenum".  
>> datestr(datenum([2014 250 250 1 1 1]))
 
ans =
 
07-Jun-2035 01:01:01