Prev: Inf
Next: access data from whole cell array
From: Rune Allnor on 23 Feb 2010 16:24 On 23 Feb, 16:03, "Steven Lord" <sl...(a)mathworks.com> wrote: > "enviro" <farhadnejadkoo...(a)yahoo.co.uk> wrote in message > > news:1088818060.255196.1266935417071.JavaMail.root(a)gallium.mathforum.org... > > > Hi there > > Do you have an idea how to fix a problem with "datevec". there seems to be > > a problem at 24 O'clock. For instance please try below example. Please > > note this is in the middle of a code with massive data so I cant change it > > manually. > > > [year, month, day,hour] =datevec('2008/03/31 24:00:00','yyyy/mm/dd > > HH:MM:SS') > > This is not a bug. Eh... it might be not be a bug in the sense that the behaviour is intended, but it *is* a bug in the sense that the behaviour is ambiguous. From the everyday language point of view the time '24:00' might make some sense, but once you get into the details, it does no longer. I think it might be wise to guard agains the 24:00 time, and instead go for 00:00 at the next day. Rune
From: TideMan on 23 Feb 2010 16:41 On Feb 24, 10:24 am, Rune Allnor <all...(a)tele.ntnu.no> wrote: > On 23 Feb, 16:03, "Steven Lord" <sl...(a)mathworks.com> wrote: > > > "enviro" <farhadnejadkoo...(a)yahoo.co.uk> wrote in message > > >news:1088818060.255196.1266935417071.JavaMail.root(a)gallium.mathforum.org.... > > > > Hi there > > > Do you have an idea how to fix a problem with "datevec". there seems to be > > > a problem at 24 O'clock. For instance please try below example. Please > > > note this is in the middle of a code with massive data so I cant change it > > > manually. > > > > [year, month, day,hour] =datevec('2008/03/31 24:00:00','yyyy/mm/dd > > > HH:MM:SS') > > > This is not a bug. > > Eh... it might be not be a bug in the sense that the > behaviour is intended, but it *is* a bug in the sense > that the behaviour is ambiguous. From the everyday > language point of view the time '24:00' might make some > sense, but once you get into the details, it does no longer. > > I think it might be wise to guard agains the 24:00 time, > and instead go for 00:00 at the next day. > > Rune But, Rune, that's what Matlab does do. It converts 24:00:00 to 00:00:00 next day. The OP was complaining that it did this instead of retaining 24:00:00. I have some other software that uses 240000 instead of 0 and it's infuriating when moving from times (in this case seconds since 1- Jan-1940) back to yyyymmdd HHMMSS format, especially since it uses integer arithmetic for the times. So, IMHO, this is not a Matlab bug, but an excellent feature.
From: Jan Simon on 23 Feb 2010 16:53 Dear TideMan! > It converts 24:00:00 to 00:00:00 next day. > So, IMHO, this is not a Matlab bug, but an excellent feature. And it is exactly what my alarm-clock does. Does anybody knows a clock which displays 24:00:00 or even 24:00:01 ?! And if you find such a clock, does this time mean, that it is tomorrow, today or yesterday? Kind regards, Jan
From: Walter Roberson on 23 Feb 2010 18:40 Jan Simon wrote: >> Question: does datevec take into account leap seconds? The most recent >> of those was 2008/12/31 24:00:00 which was -not- the same time as >> 2009/01/01 00:00:00 . I should have said 2008/12/31 23:59:60 as the time of the leap second. But the result would have been the same: > Inspected the source: No leap seconds in DATEVEC. > No support of daylight saving time tricks also.
From: XYZ on 23 Feb 2010 19:15
On 2010-02-24 00:40, Walter Roberson wrote: > Jan Simon wrote: > >>> Question: does datevec take into account leap seconds? The most >>> recent of those was 2008/12/31 24:00:00 which was -not- the same time >>> as 2009/01/01 00:00:00 . > > I should have said 2008/12/31 23:59:60 as the time of the leap second. > But the result would have been the same: > >> Inspected the source: No leap seconds in DATEVEC. >> No support of daylight saving time tricks also. Did anyone hear of an improved version that would include the above, incl. support for 1-24 hour format? Best, Rob |