<< cputime time functions datevec >>

datenum


Return the date/time input as a serial day number.


Syntax


d = datetnum(datevec)
d = datenum(datestr)
d = datenum(datestr, format)
d = datetnum(Y, M, D)
d = datetnum(Y, M, D, H, MN, S)

Input argument


datevec

a vector: [Y, M, D, H, MN, S].

format

a string: date format.

datestr

a string: text representing a date.

Y, M, D, H, MN, S

double: Year, Month, Day, Hours, Minutes, Secondes.

Output argument


d

a double: serial date number (serial day 1 corresponds to 1-Jan-0000).

Description


d = datenum() returns the serial date number corresponding to current date.

d = datenum(datevec) converts date vector to serial date number.

d = datenum(datestr) and d = datenum(datestr, format) converts string to serial date number.

Supported format conversion:

dd-mmm-yyyy HH:MM:SS 10-Mar-2010 16:48:17

dd-mmm-yyyy 10-Mar-2010

mm/dd/yyyy 03/10/2010

mm/dd/yy 03/10/00

mm/dd 03/10

mmm.dd,yyyy HH:MM:SS Mar.10,2010 16:48:17

mmm.dd,yyyy Mar.10,2010

yyyy-mm-dd HH:MM:SS 2010-03-10 16:48:17

yyyy-mm-dd 2010-03-10

yyyy/mm/dd 2000/03/10

HH:MM:SS 16:48:17

HH:MM:SS PM 3:48:17 PM

HH:MM 16:48

HH:MM PM 3:35 PM

Example


d = datenum([1973,8,4,12,1,18])
datevec(d)
d = datenum('04–Aug-1973 12:01:18')

See also


datevec.

History


Version Description
1.0.0 initial version

Author


Allan CORNET

<< cputime time functions datevec >>