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

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

[Octave-bug-tracker] [bug #42241] datevec() should allow partial matches


From: Ben Kurtz
Subject: [Octave-bug-tracker] [bug #42241] datevec() should allow partial matches when format is specified
Date: Wed, 30 Apr 2014 08:00:41 +0000
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/6.1.3 Safari/537.75.14

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

                 Summary: datevec() should allow partial matches when format
is specified
                 Project: GNU Octave
            Submitted by: bkurtz
            Submitted on: Wed 30 Apr 2014 08:00:40 AM GMT
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: Any

    _______________________________________________________

Details:

In MATLAB if I specify the format for a date, anything that matches will
parse:


>> datevec('2013-08-01 08:00:00/xyzpdq')
Error using datevec (line 213)
Failed to lookup month of year.
 
>> datevec('2013-08-01 08:00:00/xyzpdq','yyyy-mm-dd HH:MM:SS')

ans =

        2013           8           1           8           0           0


This is useful when:
* date is part of a filename (don't have to write/run code to strip the tail
end before parsing)
* just want the date of a date/time string of known format

The current octave implementation throws errors for both calls, because it
requires the full input string to match the format.

Attaching a patch that makes the behavior more like MATLAB, i.e. if a format
is specified, the conversion will work as long as the string matches the
format, even if there are extra characters at the end.




    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Wed 30 Apr 2014 08:00:40 AM GMT  Name: datevec.patch  Size: 2kB   By:
bkurtz

<http://savannah.gnu.org/bugs/download.php?file_id=31281>

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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