Create array based on current date, or convert from date strings or numbers
The datetime function creates an
array that represents points in time using the proleptic ISO calendar.
datetime values have flexible display formats
up to nanosecond precision and can account for time zones, daylight
saving time, and leap seconds.
t = datetimet = datetime(relativeDay)t = datetime(DateStrings)t = datetime(DateStrings,'InputFormat',infmt)t = datetime(DateVectors)t = datetime(Y,M,D)t = datetime(Y,M,D,H,MI,S)t = datetime(Y,M,D,H,MI,S,MS)t = datetime(X,'ConvertFrom',dateType)t = datetime(___,Name,Value) returns
a scalar t = datetimedatetime array corresponding to the current
date and time.
uses
the date specified by t = datetime(relativeDay)relativeDay. The relativeDay input
can be 'today', 'tomorrow', 'yesterday',
or 'now'.
creates
an array of datetime values from the text in t = datetime(DateStrings)DateStrings representing
points in time.
interprets t = datetime(DateStrings,'InputFormat',infmt)DateStrings using
the format specified by infmt. All values in DateStrings must
have the same format.
To avoid ambiguities between similar formats, specify 'InputFormat' and
its corresponding value, infmt.
creates
a column vector of datetime values from the date vectors in t = datetime(DateVectors)DateVectors.
creates
an array of t = datetime(Y,M,D,H,MI,S)datetime values for corresponding elements
of the Y, M,D,H, MI,
and S (year, month, day, hour, minute, and second)
arrays. The arrays must be of the same size (or any can be a scalar).
You also can specify the input arguments as a date vector, [Y,M,D,H,MI,S].
creates
an array of t = datetime(Y,M,D,H,MI,S,MS)datetime values for corresponding elements
of the Y, M,D,H, MI, S,
and MS (year, month, day, hour, minute, second,
and millisecond) arrays. The arrays must be of the same size (or any
can be a scalar).
specifies
additional options using one or more name-value pair arguments, in
addition to any of the input arguments in the previous syntaxes. For
example, you can specify the display format of t = datetime(___,Name,Value)t using
the 'Format' name-value pair argument.
For best performance when creating datetime values from text,
specify either 'Format' or 'InputFormat' and
its corresponding value, infmt.