Documentation

days365

Days between dates based on 365-day year

Syntax

NumDays = days365(StartDate, EndDate)

Arguments

StartDate

Enter as serial date numbers, date character vectors, or datetime arrays.

EndDate

Enter as serial date numbers, date character vectors, or datetime arrays.

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 character vectors, then EndDate must be an n-by-1 vector of integers or a single integer. NumDays is then an n-by-1 vector of date numbers.

Description

NumDays = days365(StartDate, EndDate) returns the number of days between dates StartDate and EndDate based on a 365-day year. (All months contain their actual number of days. February always contains 28 days.) If EndDate is earlier than StartDate, NumDays is negative. NumDays returns as a double for serial date number, date character vector, and datetime inputs.

Examples

NumDays = days365('15-jan-2000', '15-mar-2000')
NumDays =

    59
NumDays = days365(datetime('15-jan-2000','Locale','en_US'), '15-mar-2000')
NumDays =

    59
MoreDays = ['15-mar-2000'; '15-apr-2000'; '15-jun-2000'];
NumDays = days365('15-jan-2000', MoreDays)
NumDays =

    59
    90
   151

Related Examples

Introduced before R2006a

Was this topic helpful?