I’m reading a string representing a date, yet it seem to ignore the input and use the default January as month, e.g.
>>datestr(now, 'YYYY-mm-DD HH:MM:SS')
ans =
2011-11-02 19:04:09
but
>> datestr(datenum('2011-11-02 19:04:09', 'YYYY-mm-DD HH:MM:SS'))
ans =
02-Jan-2011 19:04:09
What am I missing?
p.s. I use Windows 7 64 bit and Matlab R2011a, if it matters
The format your date is entered isn’t supported by Matlab (see the datestr doc):
Use:
instead and it works fine…