FUNCTION REFERENCE
datenum
Serial date number.
Serial date number.
Syntax
n = datenum(Y, M, D)Syntax
n = datenum(Y, M, D, H, MI, S)Syntax
n = datenum(V)Syntax
n = datenum(text, format)Syntax
n = datenum(text)Day 1 is 1-Jan-0000 in the proleptic Gregorian calendar; the time of day is the
fraction. A month or day out of range rolls over: datenum(2016, 13, 1) is
1-Jan-2017 and datenum(2016, 1, 0) is 31-Dec-2015. Scalar arguments combine
with arrays of one common size. V is a date vector or a matrix of them (3 or 6
columns); the result is a column. Text is read with the format (the tokens of
datestr), or without one in the forms 'dd-mmm-yyyy HH:MM:SS', 'dd-mmm-yyyy',
'mm/dd/yy', 'mm/dd/yyyy', 'mmm.dd,yyyy HH:MM:SS', 'mmm.dd,yyyy' and
'yyyy-mm-dd HH:MM:SS'. A numeric second argument after text is the pivot year
for two-digit years (default: the current year less 50).
Example
datenum(2016, 3, 1) % 736390Example
datenum('2016-03-01 12:30', 'yyyy-mm-dd HH:MM') % 7.3639e+05Differences from MATLAB: Date text without a year (such as
'15:00', which MATLAB places in the current year) is rejected; cell arrays of
text are not supported yet.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.