Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

daysadd

Date away from starting date for any day-count basis

Syntax

  • NewDate = daysadd(StartDate,NumDays)
  • NewDate = daysadd(StartDate,NumDays,Basis)

Description

NewDate = daysadd(StartDate,NumDays) returns a date NewDate number of days away from StartDate.

If StartDate is a serial date number or date character vector, NewDate is returned as a date number.

If StartDate is a datetime array, then NewDate is returned as a datetime array.

NewDate = daysadd(StartDate,NumDays,Basis) returns a date NewDate number of days away from StartDate, using the given day-count Basis.

If StartDate is a serial date number or date character vector, NewDate is returned as a date number.

If StartDate is a datetime array, then NewDate is returned as a datetime array.

Examples

collapse all

Determine the NewDate using a date character vector for StartDate.

NewDate = daysadd('01-Feb-2004', 31)
datestr(NewDate)
NewDate =

      732009


ans =

03-Mar-2004

Determine the NewDate using a datetime array for StartDate.

NewDate = daysadd(datetime('01-Feb-2004','Locale','en_US'), 31)
NewDate = 

  datetime

   03-Mar-2004

Determine the NewDate using a vector for StartDate.

MoreDays = ['09/07/2002'; '10/22/2002'; '11/05/2002'];
NewDate = daysadd(MoreDays, 31 ,2)
datestr(NewDate)
NewDate =

      731497
      731542
      731556


ans =

08-Oct-2002
22-Nov-2002
06-Dec-2002

Related Examples

Input Arguments

collapse all

Start date, specified as a scalar or an N-by-1 or 1-by-N vector using serial date numbers, date character vectors, or datetime arrays.

Data Types: double | char | datetime

Number of days from StartDate, specified an N-by-1 or 1-by-N vector using positive or negative integers. Enter a negative integer for dates before start date.

Data Types: double

Day-count basis of the instrument, specified as an integer with a value of 0 through 13 or a N-by-1 vector of integers with values of 0 through 13.

  • 0 = actual/actual (default)

  • 1 = 30/360 (SIA)

  • 2 = actual/360

  • 3 = actual/365

  • 4 = 30/360 (BMA)

  • 5 = 30/360 (ISDA)

  • 6 = 30/360 (European)

  • 7 = actual/365 (Japanese)

  • 8 = actual/actual (ICMA)

  • 9 = actual/360 (ICMA)

  • 10 = actual/365 (ICMA)

  • 11 = 30/360E (ICMA)

  • 12 = actual/365 (ISDA)

  • 13 = BUS/252

For more information, see basis.

    Note   When using the 30/360 day-count basis, it is not always possible to find the exact date NewDate number of days away because of a known discontinuity in the method of counting days. A warning is displayed if this occurs.

Data Types: single | double

Output Arguments

collapse all

Date for given number of days away from StartDate, returned as a scalar or an N-by-1 vector containing dates.

If StartDate is a serial date number or date character vector, NewDate is returned as a date number.

If StartDate is a datetime array, then NewDate is returned as a datetime array.

References

Stigum, Marcia L. and Franklin Robinson. Money Market and Bond Calculations. Richard D. Irwin, 1996, ISBN 1-55623-476-7

See Also

|

Introduced before R2006a

Was this topic helpful?