Financial Toolbox    
daysdif

Days between dates for any day-count basis

Syntax

Arguments

StartDate
Enter as serial date numbers or date strings.
EndDate
Enter as serial date numbers or date strings.
Basis
(Optional) Day-count basis: 0 = actual/actual (default), 1 = 30/360, 2 = actual/360, 3 = actual/365.

Any input argument can contain multiple values, but if so, the 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 EndDate must be an n-row character array of date strings or a single date. NumDays is then an n-by-1 vector of numbers.

Description

NumDays = daysdif(StartDate, EndDate, Basis) returns the number of days between dates StartDate and EndDate using the given day-count basis. Enter dates as serial date numbers or date strings.

This function is a helper function for the bond pricing and yield functions. It is designed to make the code more readable and to eliminate redundant calls within if statements.

Examples

See Also

datenum, days360, days365, daysact, wrkdydif, yearfrac


  daysact depfixdb