| MATLAB Function Reference | Search  Help Desk |
| datestr | See Also |
Syntax
str = datestr(D,dateform)str = datestr(D,dateform,P)
Description
str = datestr(D,dateform)
converts each element of the array of serial date numbers (D) to a string. Date strings with two-character years, e.g., 12-june-12, are assumed to lie within the 100-year period centered about the current year.
str = datestr(D,dateform,P)
assumes that two-character years lie within the 100-yearperiod beginning with the pivot year p. The default pivot year is the current year minus 50 years.
The optional argument dateform specifies the date format of the result. dateform can be either a number or a string:dateform numbers 0, 1, 2, 6, 13, 14, 15, and 16 produce a string suitable for input to datenum or datevec. Other date string formats will not work with these functions.
Time formats like 'h:m:s', 'h:m:s.s', 'h:m pm', ... may also be part of the input array D. If you do not specify dateform, the date string format defaults to
D contains date information only (01-Mar-1995)
D contains time information only (03:45 PM)
D contains both date and time information (01-Mar-1995 03:45)
See Also
date, datenum, datevec