Products & Services Solutions Academia Support User Community Company

Learn more about Financial Toolbox   

daysact - Actual number of days between dates

Syntax

NumDays = daysact(StartDate, EndDate)

Arguments

StartDate

Enter as serial date numbers or date strings.

EndDate

(Optional) Enter as serial date numbers or date strings.

Either input can contain multiple values, but if so, the other 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 = daysact(StartDate, EndDate) returns the actual number of days between two dates. Enter dates as serial date numbers or date strings. NumDays is negative if EndDate is earlier than StartDate.

NumDays = daysact(StartDate) returns the actual number of days between the MATLAB base date and StartDate. In MATLAB software, the base date 1 is 1-Jan-0000 A.D. See datenum for a similar function.

Examples

NumDays = daysact('7-sep-2002',  '25-dec-2002')
NumDays =
   109

NumDays = daysact('9/7/2002')
NumDays =
      731466

MoreDays = ['09/07/2002'; '10/22/2002'; '11/05/2002'];
NumDays = daysact(MoreDays, '12/25/2002')
NumDays =
   109
    64
    50

See Also

datenum, datevec, days360, days365, daysdif

  


Free Interactive Computational Finance CD

View demos and recorded presentations led by industry experts.

Now On Demand
Network with industry peers and learn the latest applications of the leading software product for computational finance.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS