| MATLAB Function Reference | Search  Help Desk |
| datevec | Examples See Also |
C = datevec(A) [Y,M,D,H,MI,S] = datevec(A)
C = datevec(A)
splits its input into an n-by-6 array with each row containing the vector [Y,M,D,H,MI,S]. The first five date vector elements are integers. Input A can either consist of strings of the sort produced by the datestr function, or scalars of the sort produced by the datenum and now functions.
[Y,M,D,H,MI,S] = datevec(A)
returns the components of the date vector as individual variables.
When creating your own date vector, you need not make the components integers. Any components that lie outside their conventional ranges affect the next higher component (so that, for instance, the anomalous June 31 becomes July 1). A zeroth month, with zero days, is allowed.
Let
d = '12/24/1984' t = '725000.00',Then
datevec(d) and datevec(t) generate [1984 12 24 0 0 0].
clock Current time as date vector
datenum Serial date number
datestr Date string format