tf_quant_finance.datetime.utils.leap_days_between

Contents

Last updated: 2023-03-16.

tf_quant_finance.datetime.utils.leap_days_between#

View source

Calculates number of leap days (29 Feb) between two dates.

tf_quant_finance.datetime.utils.leap_days_between(
    start_date, end_date
)

‘start_date’ is included and ‘end_date’ is excluded from the period.

For example, for dates 2019-12-24 and 2024-3-10 the result is 2: there is 29 Feb 2020 and 29 Feb 2024 between 24 Dec 2019 (inclusive) and 10 Mar 2024 (exclusive).

If end_date is earlier than start_date, the result will be negative or zero.

Args:#

  • start_date: DateTensor.

  • end_date: DateTensor compatible with start_date.

Returns:#

Tensor of type ‘int32’.