Financial Toolbox
  Go to function:
    Search    Help Desk 
datestr    Examples   See Also

Create date string.

Syntax

Description

ds = datestr(d, dateform) converts a date number or a date string d to a date string ds. dateform specifies the format of ds. 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.

ds = datestr(d, dateform, p) assumes that two-character years lie within the 100-year period beginning with the pivot year p . The default pivot year is the current year minus 50 years.

ds = datestr(d) assumes dateform is 1, 16, or 0 depending on whether the date number d contains a date, time, or both, respectively. If d is a date string, the function assumes dateform is 1.

dateform
Format
Description
0
01-Mar-1995 15:45:17
day-month-year hour:minute:second
1
01-Mar-1995
day-month-year
2
03/01/95
month/day/year
3
Mar
month, three letters
4
M
month, single letter
5
3
month
6
03/01
month/day
7
1
day of month
8
Wed
day of week, three letters
9
W
day of week, single letter
10
1995
year, four digits
11
95
year, two digits
12
Mar95
month year
13
15:45:17
hour:minute:second
14
03:45:17 PM
hour:minute:second AM or PM
15
15:45
hour:minute
16
03:45 PM
hour:minute AM or PM
17
Q1-95
calendar quarter-year
18
Q1
calendar quarter

Note:
This function now ships with basic MATLAB. It originally shipped only with the Financial Toolbox, and this description remains here for your convenience.

Examples

See Also

dateaxis, datenum, datevec, daysact, now, today



[ Previous | Help Desk | Next ]