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: Nicholas Jankowski
Subject: [Octave-bug-tracker] [bug #42241] datevec() should allow partial matches when format is specified
Date: Mon, 14 Aug 2023 22:08:35 -0400 (EDT)

Follow-up Comment #7, bug #42241 (project octave):

looking to answer my question about ambiguities and ignoring the issue of
'extraneous trailing characters', i looked at the first two standard
datestring formats:

1. dd-mmm-yyyy HH:MM:SS 07-Sep-2000 15:38:09
1 dd-mmm-yyyy          07-Sep-2000

currently in Matlab, specifying the second type when presented with the first
gives you a valid answer with the date components requested since there is a
partial match:

Matlab 2023a:

>> datevec('2013-08-01 08:00:00','yyyy-mm-dd HH:MM:SS')
ans =
        2013           8           1           8           0           0
>> datevec('2013-08-01 08:00:00','yyyy-mm-dd')
ans =
        2013           8           1           0           0           0


in Octave this gives an error:

octave:1> datevec('2013-08-01 08:00:00','yyyy-mm-dd HH:MM:SS')
ans =

   2013      8      1      8      0      0

octave:2> datevec('2013-08-01 08:00:00','yyyy-mm-dd')
error: datevec: DATE not parsed correctly with given format
error: called from
    datevec at line 155 column 11


Absent objections, I think this should become standard Octave behavior as
well, including documentation. i'll work up some possible docstring text to
add to the patch.


    _______________________________________________________

Reply to this item at:

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

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

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