MATLAB Function Reference | ![]() ![]() |
Syntax
str = datestr(D,dateform
) str = datestr(D,dateform
,P)
Description
str = datestr(D,
converts each element of the array of serial date numbers (dateform
)
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,
uses the specified pivot year as the starting year of the 100-year range in which a two-character year resides. The default pivot year is the current year minus 50 years.dateform
,P)
The optional argument dateform
specifies the date format of the result. dateform
can be either a number or a string:
NOTE
dateform numbers 0 , 1 , 2 , 6 , 13 , 14 , 15 , 16 , and 23 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
1 |
if D contains data information only (01-Mar-1995) |
16 |
if D contains time information only (03:45 PM) |
0 |
if D contains both date and time information (01-Mar-1995 03:45) |
See Also
![]() | datenum | datetick | ![]() |