Detailed instructions for use are in the User's Guide.
[. . . ] Financial ToolboxTM 3 User's Guide
How to Contact The MathWorks
Web Newsgroup www. mathworks. com/contact_TS. html Technical Support
www. mathworks. com comp. soft-sys. matlab suggest@mathworks. com bugs@mathworks. com doc@mathworks. com service@mathworks. com info@mathworks. com
Product enhancement suggestions Bug reports Documentation error reports Order status, license renewals, passcodes Sales, pricing, and general information
508-647-7000 (Phone) 508-647-7001 (Fax) The MathWorks, Inc. 3 Apple Hill Drive Natick, MA 01760-2098
For contact information about worldwide offices, see the MathWorks Web site. Financial ToolboxTM User's Guide © COPYRIGHT 19952010 The MathWorks, Inc.
The software described in this document is furnished under a license agreement. The software may be used or copied only under the terms of the license agreement. [. . . ] Vector containing number of months in future (positive) or past (negative). (Optional) Vector containing values that specify how the actual day number for the target date in future or past month is determined. 0 (default) = day number should be the day in the future or past month corresponding to the actual day number of the start date. 1 = day number should be the first day of the future or past month. 2 = day number should be the last day of the future or past month. This flag has no effect if EndMonthRule is set to 1. (Optional) Day-count basis of the instrument. · 0 = actual/actual (default) · 1 = 30/360 (SIA) · 2 = actual/360 · 3 = actual/365 · 4 = 30/360 (PSA) · 5 = 30/360 (ISDA)
DayFlag
Basis
14-216
datemnth
· 6 = 30/360 (European) · 7 = actual/365 (Japanese) · 8 = actual/actual (ISMA) · 9 = actual/360 (ISMA) · 10 = actual/365 (ISMA) · 11 = 30/360E (ISMA) · 12 = actual/365 (ISDA) · 13 = BUS/252
EndMonthRule
(Optional) End-of-month rule. 1 = rule in effect, meaning that if you are beginning on the last day of a month, and the month has 30 or fewer days, you will end on the last actual day of the future or past month regardless of whether that month has 28, 29, 30 or 31 days) 0 = rule off (default), meaning that the rule is not in effect.
Any input can contain multiple values, but if so, all other inputs must contain the same number of values or a single value that applies to all. For example, if StartDate is an n-row character array of date strings, then NumberMonths must be an n-by-1 vector of integers or a single integer. TargetDate is then an n-by-1 vector of date numbers.
Description
TargetDate = datemnth(StartDate, NumberMonths, DayFlag, Basis, EndMonthRule) returns the serial date number of the target
date in the future or past. Use datestr to convert serial date numbers to formatted date strings.
Examples
Day = datemnth('3 jun 2001', 6, 0, 0, 0) Day =
14-217
datemnth
731188 datestr(Day) ans = 03-Dec-2001 Day = datemnth('3 jun 2001', 6, 1, 0, 1); datestr(Day) ans = 01-Dec-2001 Day = datemnth('31 jan 2001', 5, 0, 0, 0); datestr(Day) ans = 30-Jun-2001 Day = datemnth('31 jan 2001', 5, 1, 0, 0); datestr(Day) ans = 01-Jun-2001 Day = datemnth('31 jan 2001', 5, 1, 0, 1); datestr(Day) ans = 30-Jun-2001 Day = datemnth('31 jan 2001', 5, 2, 0, 1); datestr(Day) ans = 30-Jun-2001 Months = [1; 3; 5; 7; 9]; Day = datemnth('31 jan 2001', Months); datestr(Day) ans = 28-Feb-2001 30-Apr-2001 30-Jun-2001 31-Aug-2001 31-Oct-2001
See Also
datestr, datevec, days360, days365, daysact, daysdif, wrkdydif
14-218
datenum
Purpose Syntax
Create date number
N = datenum(V) N = datenum(S, F) N = datenum(S, F, P)
N = datenum([S, P, F])
N N N N
= = = =
datenum(Y, M, D) datenum(Y, M, D, H, MN, S) datenum(S) datenum(S, P)
Description
datenum is one of three conversion functions that enable you to express dates and times in any of three formats in MATLAB software: a string (or date string), a vector of date and time components (or date vector), or as a numeric offset from a known date in time (or serial date number). Here is an example of a date and time expressed in the three MATLAB formats: Date String: Date Vector: Serial Date Number: '24-Oct-2003 12:45:07' [2003 10 24 12 45 07] 7. 3188e+005
A serial date number represents the whole and fractional number of days from a specific date and time, where datenum('Jan-1-0000 00:00:00') returns the number 1. (The year 0000 is merely a reference point and is not intended to be interpreted as a real year in time. )
N = datenum(V) converts one or more date vectors V to serial date numbers N. Input V can be an m-by-6 or m-by-3 matrix containing m full or partial date vectors respectively. A full date vector has six elements, specifying year, month, day, hour, minute, and second, in that order. A partial date vector has three elements, specifying year, month, and day, in that order. Each element of V must be a positive double-precision number. datenum returns a column vector of m date numbers, where m is the total number of date vectors in V. N = datenum(S, F) converts one or more date strings S to serial date numbers N using format string F to interpret each date string. Input S
14-219
datenum
can be a one-dimensional character array or cell array of date strings. All date strings in S must have the same format, and that format must match one of the date string formats shown in the help for the datestr function. [. . . ] The option gives the holder the right to enter into a contracted interest-rate swap at a specified future date. term structure The relationship between the yields on fixed-interest securities and their maturity dates. Expectation of changes in interest rates affects term structure, as do liquidity preferences and hedging pressure. A yield curve is one representation in the term structure. [. . . ]