Skip to the content.

todatetime - janklab.mlxshake.internal.util

Convert values to datetime array

out = todatetime(x) out = todatetime(x, zonePolicy)

TODATETIME converts an input array to a datetime array. It is an alternative to the datetime constructor, and is provided because MPT thinks Matlab got the datetime constructor behavior wrong: in the one-arg constructor, numeric inputs are interpreted as datevecs instead of datetimes; but we think that datenums are in more common use and should have been the default interpretation of numeric inputs. In addition, DATETIME does not support Java date/time types as inputs.

TODATETIME also provides a zonePolicy argument for convenient setting of the TimeZone on the constructed datetimes.

x may be any of:

zonePolicy is a string indicating how the TimeZone on the constructed datetime array should be set. It may be one of:

The way the zone policy is applied is:

If the input x is a datetime or zoned Java date and a zonePolicy is provided, but the zonePolicy conflicts with the actual TimeZone set on x, an error is raised.

Returns a datetime array.