MATLAB Function Reference
  Go to function:
    Search    Help Desk 
datenum    Examples   See Also

Serial date number

Syntax

Description

The datenum function converts date strings and date vectors into serial date numbers. Date numbers are serial days elapsed from some reference date. By default, the serial day 1 corresponds to 1-Jan-0000.

N = datenum(str) converts the date string str into a serial date number.

NOTE
The string str must be in one of the date formats 0, 1, 2, 6, 13, 14, 15, or 16 as defined by datestr.

N = datenum(Y,M,D) returns the serial date number for corresponding elements of the Y, M, and D (year, month, day) arrays. Y, M, and D must be arrays of the same size (or any can be a scalar). Values outside the normal range of each array are automatically "carried" to the next unit.

N = datenum(Y,M,D,H,MI,S) returns the serial date number for corresponding elements of the Y, M, D, H, MI, and S (year, month, hour, minute, and second) array values. Y, M, D, H, MI, and S must be arrays of the same size (or any can be a scalar).

Examples

n = datenum('19-May-1995') returns n = 728798.

n = datenum(1994,12,19) returns n = 728647.

n = datenum(1994,12,19,18,0,0) returns n = 7.2865e+05 .

See Also

datestr     Date string format

datevec     Date components

now         Current date and time



[ Previous | Help Desk | Next ]