Programming |
Output Formats
The command datestr
(D, dateform)
converts a serial date D
to one of 19 different date string output formats showing date, time, or both. The default output for dates is a day-month-year string: 01-Mar-1996. You select an alternative output format by using the optional integer argument dateform
.
This table shows the date string formats that correspond to each dateform
value.
Converting Output Format with datestr
Here are some examples of converting the date March 1, 1996 to various forms using the datestr
function:
d = '01-Mar-1999' d = 01-Mar-1999 datestr(d) ans = 01-Mar-1999 datestr(d, 2) ans = 03/01/99 datestr(d, 17) ans = Q1-99
Date String Formats | Current Date and Time |
© 1994-2005 The MathWorks, Inc.