datetime.setDefaultFormats
datetime: datetime.setDefaultFormats ('default', fmt)
datetime: datetime.setDefaultFormats ('defaultdate', fmt)
datetime: datetime.setDefaultFormats ('reset')
Set the default display formats of datetime arrays.
A datetime array whose Format property was never set explicitly
displays with one of two default formats, and this method chooses them.
The choice between the two is made from the values: an array whose
elements all sit at midnight uses the date-only default, and any other
array uses the date-and-time default. The choice is made afresh on every
display, so an array moves between the two when its components change.
datetime.setDefaultFormats ( sets the
date-and-time default to fmt, and
'default', fmt)datetime.setDefaultFormats ( sets
the date-only default. fmt is a display format, given as a
character vector or string scalar, and is validated as the 'defaultdate', fmt)Format
property is. Arrays that already exist take the new format on their next
display; those with an explicitly set Format are unaffected.
datetime.setDefaultFormats ( restores both factory
formats, 'reset')'dd-MMM-uuuu HH:mm:ss' and 'dd-MMM-uuuu'.
Both formats persist across Octave sessions.
Deviation from MATLAB. MATLAB accepts a second argument after
'reset' and silently ignores it, resetting both defaults whatever
it says, so datetime.setDefaultFormats ('reset', 'default') reads
as a request to reset one and quietly resets two. Anything at all is
accepted there, a number included. Here that is an error, since no
correct program can depend on the argument being ignored.
Source Code: datetime