# days360psa

Days between dates based on 360-day year (Public Securities Association (PSA) compliant)

## Syntax

``NumDays = days360psa(StartDate,EndDate)``

## Description

example

````NumDays = days360psa(StartDate,EndDate)` returns the number of days between `StartDate` and `EndDate` based on a 360-day year (that is, all months contain 30 days) and is Public Securities Association (PSA) compliant. If `EndDate` is earlier than `StartDate`, `NumDays` is negative. Under this convention, all months contain 30 days.Either input argument 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 datetime, 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. ```

## Examples

collapse all

Determine the `NumDays` using date character vectors for `StartDate` and `EndDate` for the month of January.

```StartDate = '1-Jan-2002'; EndDate = '1-Feb-2002'; NumDays = days360psa(StartDate, EndDate)```
```NumDays = 30 ```

Determine the `NumDays` in the month of January using datetimes for `StartDate` and `EndDate`.

`NumDays = days360psa(datetime(2002,1,1) , datetime(2002,2,1))`
```NumDays = 30 ```

Determine the `NumDays` using a datetime array for `EndDate`.

```MoreDays = [datetime(2000,3,15) ; datetime(2000,4,15) ; datetime(2000,6,15)]; NumDays = days360psa(datetime(2000,1,15), MoreDays)```
```NumDays = 3×1 60 90 150 ```

## Input Arguments

collapse all

Start date, specified as a scalar or an `N`-by-`1` or `1`-by-`N` vector using a datetime array, string array, or date character vectors.

To support existing code, `days360psa` also accepts serial date numbers as inputs, but they are not recommended.

Data Types: `char` | `string` | `datetime`

End date, specified as a scalar or an `N`-by-`1` or `1`-by-`N` vector using a datetime array, string array, or date character vectors.

To support existing code, `days360psa` also accepts serial date numbers as inputs, but they are not recommended.

Data Types: `char` | `string` | `datetime`

## Output Arguments

collapse all

Number of days between two dates given a basis of 30/360 based on Public Securities Association (PSA) compliance, returned as a scalar or an `N`-by-`1` or `1`-by-`N` vector containing the number of days.

## References

[1] Addendum to Securities Industry Association, Standard Securities Calculation Methods: Fixed Income Securities Formulas for Analytic Measures. Vol. 2, Spring 1995.

## Version History

Introduced before R2006a

expand all