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

Date components

Description

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.

Examples

Let

Then datevec(d) and datevec(t) generate [1984 12 24 0 0 0].

See Also

clock       Current time as date vector

datenum     Serial date number

datestr     Date string format



[ Previous | Help Desk | Next ]