Why does the DATENUM function return incorrect result in MATLAB 7.0 (R14)?

This behavior can be reproduced using the following commands:
1. use the DATESTR command to convert a date number to a date string:
datestr(1)
This returns the expected result:
ans =
01-Jan-0000
2. Reverse the action by using the DATENUM command to convert the output string back to a date number:
datenum(datestr(1))
The expected output should be 1; however, it is 367.
ans =
367
This error only affects the year 0000.

 采纳的回答

This bug has been fixed for Release 14 SP1 (R14SP1). For previous releases, please read below for any possible workarounds:
This occurs because the year 0000 is only a reference year, and is not recognized as an actual year.
To workaround this issue, avoid using dates that utilize the year 0000.

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Time Series Objects 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by