8.2.66 todatetime

Function: out = todatetime (x)

Convert input to a Tablicious datetime array, with convenient interface.

This is an alternative to the regular datetime constructor, with a signature and conversion logic that Tablicious’s author likes better.

This mainly exists because datetime’s constructor signature does not accept datenums, and instead treats one-arg numeric inputs as datevecs. (For compatibility with Matlab’s interface.) I think that’s less convenient: datenums seem to be more common than datevecs in M-code, and it returns an object array that’s not the same size as the input.

Returns a datetime array whose size depends on the size and type of the input array, but will generally be the same size as the array of strings or numerics the input array "represents".