The date and time data types datetime, duration, and calendarDuration support efficient computations, comparisons, and formatted display of dates and times. Work with these arrays in the same way that you work with numeric arrays. You can add, subtract, sort, compare, concatenate, and plot date and time values. You also can represent dates and times as numeric arrays or as text. For more information, see Represent Dates and Times in MATLAB or watch Date and Time Arrays.
years |
Duration in years |
days |
Duration in days |
hours |
Duration in hours |
minutes |
Duration in minutes |
seconds |
Duration in seconds |
milliseconds |
Duration in milliseconds |
duration |
Lengths of time in fixed-length units |
calyears |
Calendar duration in years |
calquarters |
Calendar duration in quarters |
calmonths |
Calendar duration in months |
calweeks |
Calendar duration in weeks |
caldays |
Calendar duration in days |
calendarDuration |
Lengths of time in variable-length calendar units |
isdatetime |
Determine if input is datetime array |
isduration |
Determine if input is duration array |
iscalendarduration |
Determine if input is calendar duration array |
isnat |
Determine NaT (Not-a-Time) elements |
isdst |
Determine daylight saving time elements |
isweekend |
Determine weekend elements |
leapseconds |
List all leap seconds supported by datetime data type |
timezones |
List time zones |
tzoffset |
Time zone offset from UTC |
datenum |
Convert date and time to serial date number |
convertTo |
Convert datetime values to numeric representations |
datevec |
Convert date and time to vector of components |
exceltime |
Convert MATLAB datetime to Excel date number |
juliandate |
Convert MATLAB datetime to Julian date |
posixtime |
Convert MATLAB datetime to POSIX time |
yyyymmdd |
Convert MATLAB datetime to YYYYMMDD numeric value |
addtodate |
Modify date number by field |
now |
Current date and time as serial date number |
clock |
Current date and time as date vector |
date |
Current date as character vector |
etime |
Time elapsed between date vectors |