octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #36954] datenum and datevec convert date strin


From: anonymous
Subject: [Octave-bug-tracker] [bug #36954] datenum and datevec convert date string incorrectly
Date: Thu, 26 Jul 2012 02:42:59 +0000
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20120714 Iceweasel/3.5.16 (like Firefox/3.5.16)

URL:
  <http://savannah.gnu.org/bugs/?36954>

                 Summary: datenum and datevec convert date string incorrectly
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Thu 26 Jul 2012 02:42:58 AM UTC
                Category: None
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 3.2.4
        Operating System: GNU/Linux

    _______________________________________________________

Details:

I have noticed that the functions datenum and datevec incorrectly convert date
strings. Specifically, a date string that represents 2:00am is converted to a
serial date number and date vector as 3:00am. I have only seen this behavior
for the hour of 2:00am in the month of March in the years 2007-2010. The day
on which the error occurs depends on the year. In 2007, 2008, 2009 and 2010,
the error occurs on March 11, 9, 8 and 14, respectively. The following example
illustrates the error for March 11, 2007.

code:

for h=1:4
  s = sprintf('03/11/2007 %02d:00',h)
  n = datenum(s)
  v = datevec(s)
end


output:

s = 03/11/2007 01:00
n =  733112.041666667
v =

   2007      3     11      1      0      0

s = 03/11/2007 02:00
n =  733112.125000000
v =

   2007      3     11      3      0      0

s = 03/11/2007 03:00
n =  733112.125000000
v =

   2007      3     11      3      0      0

s = 03/11/2007 04:00
n =  733112.166666667
v =

   2007      3     11      4      0      0






    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?36954>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]