datetime

Methods

Method Reference: datetime.cat

datetime: C = cat (dim, A, B, …)

Concatenate datetime arrays.

C = cat (dim, A, B, …) concatenates the inputs A, B, … along dimension dim. They must have the same size except along the operating dimension dim.

At least one input must be a datetime array. Date/time text, whether a character vector, a cellstr, or a string array, is converted; a 0×0 empty [] or {} contributes nothing and is dropped, so an array may be accumulated from an empty start. Any other input, an empty numeric array of non-zero size included, is an error.

The first datetime input gives the result its Format and TimeZone, and is what date/time text is read against: such text names a wall clock in that time zone rather than an instant to be converted into it. Text may therefore appear first, as in ['2024-01-01', T], and still be read in T’s zone.

Zoned inputs need not share a time zone; each is converted into the zone of the first, which preserves the instant every element names and changes only its wall-clock reading. A zoned input cannot be concatenated with an unzoned one, in either order: a wall clock that names no instant and one that does do not belong in the same array. A bare NaT and datetime.empty are unzoned and so take part in that rule, whereas NaT ('TimeZone', tz) does not.

Date/time text that is empty names no date and becomes NaT, so an empty character vector adds one missing element, whereas an empty {} holds no text at all and adds none.

Source Code: datetime