| Financial Toolbox | ![]() |
Syntax
NumDays = daysact(StartDate, EndDate)
StartDate |
Enter as serial date numbers or date strings. |
EndDate |
(Optional) Enter as serial date numbers or date strings. |
Either input argument can contain multiple values, but if so, the other input 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, 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=109NumDays= daysact('9/7/2002')NumDays=731466MoreDays = ['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
| days365 | daysdif | ![]() |