Categories &

Functions List

Class Definition: datetime

datatypes: datetime

Array representing points in time using the Gregorian calendar.

A datetime array stores internally the datetime points as double arrays representing whole years, months, days, hours, and minutes, as well as seconds including their fractional part. The underlying implementation relies on the 'date.h' C++ library. The precision of this implementation is set at microseconds, which is substantial for typical times.

A datetime array is a collection of date/time elements, with each element holding a complete date/time. The datetime array also has TimeZone and Format properties associated with it, which apply to all elements in the array.

See also: calendarDuration, duration

Source Code: datetime

The datetime class contains the following properties:

A read-only property specifying the local time zone of the system, where Octave is running.

Display format, specified as a character vector or string scalar. If specified as a string scalar, it is converted and stored internally as a character vector.

Time zone, specified as a character vector or string scalar. If specified as a string scalar, it is converted and stored internally as a character vector.

The datetime class offers the following public methods:

datetime Create a new array of datetime values.
dispstrings Get display formatted strings for each element of a datetime object.
cellstr Convert datetime array to a cell array of character vectors.
char Convert datetime array to a character matrix.
ymd Year, Month, and Day components of datetime array.
hms Hour, Minute, and Second components of a datetime array.
year Year component of a datetime array.
quarter Quarter component of a datetime array.
month Month component of a datetime array.
day Day component of a datetime array.
hour Hour component of a datetime array.
minute Minute component of a datetime array.
second Seconds component of a datetime array.
size Size of a datetime array.
ndims Number of dimensions in a datetime array.
numel Total number of elements in a datetime array.
length Length of a datetime vector.
keyHash Generate a hash code for datetime array.
datevec Convert datetime array to date vectors.
iscolumn Return true if datetime array is a column vector.
isempty Return true if datetime array is empty.
isfinite Test for finite elements in datetime array.
isinf Test for infinite elements in datetime array.
ismatrix Return true if datetime array is a 2-D array.
ismissing Test for missing elements in datetime array.
isnat Test for Not-A-Time elements in datetime array.
isrow Return true if datetime array is a row vector.
isscalar Return true if datetime array is a scalar.
isvector Return true if datetime array is a vector.
cat Concatenate datetime arrays.
horzcat Horizontal concatenation of datetime arrays.
vertcat Vertical concatenation of datetime arrays.
repmat Repeat copies of a datetime array.
repelem Repeat copies of datetime array elements.
repelems Construct a vector of repeated elements from a datetime array.
reshape Reshape datetime array.
circshift Circularly shift the elements in a datetime array.
permute Generalized transpose for a datetime N-D array.
ipermute Inverse of the generalized transpose for a datetime N-D array.
transpose Transpose a datetime matrix.
ctranspose Transpose a datetime matrix.