Limits in hours in date vectors (datevec function)
Ältere Kommentare anzeigen
Hello, I was wondering what are the true carryover limits to the date vectors. For instance, when I insert: A = [2000,1,1,30,0,0]; B = datestr(A); MATLAB understands that this is the 6th hour of the next day and correctly returns: '02-Jan-2000 06:00:00' Then if you return it as C = datevec(B); the date vector will have been fixed to the MATLAB format.
But if you insert something more extravagant, yet reasonable such as A = [2000,1,1,500,0,0]; (the 500th hour after the start of 01/01/2000), then datestr does not return a valid value. There appears to be a limit somewhere, even within the same month. Do you know the limits to this? One can easily make a workaround with a custom script, but MATLAB is supposed to do the carryover automatically.
1 Kommentar
Kirby Fears
am 3 Feb. 2016
Bearbeitet: Kirby Fears
am 3 Feb. 2016
I did some initial tests and found a limit for negative hours as well. However, the limit I find varies depending on the date I start with. Will post an answer if I find the actual cause.
I found that using datestr(datenum(A)) works in your example, so this appears to be a datestr(datevec) quirk.
Akzeptierte Antwort
Weitere Antworten (1)
Bouz
am 3 Feb. 2016
Kategorien
Mehr zu Time Series Objects finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!