# Dealing with leap years

**URL:** https://discourse.julialang.org/t/dealing-with-leap-years/53516
**Category:** General Usage
**Created:** [January 18, 2021, 4:39am UTC](https://discourse.julialang.org/t/dealing-with-leap-years/53516 "2021-01-18T04:39:30Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![Ian\_Slagle](https://avatars.discourse-cdn.com/v4/letter/i/b5a626/32.png) [@Ian\_Slagle](https://discourse.julialang.org/u/Ian_Slagle)
#### Post date: [January 18, 2021, 5:54am UTC](https://discourse.julialang.org/t/dealing-with-leap-years/53516/2 "2021-01-18T05:54:06Z")

</div>

I would try using Dates (from the standard library docs here: [Dates · The Julia Language](https://docs.julialang.org/en/v1/stdlib/Dates/))

For your example:

> [@askvorts](#):
>
> a function that returns the number of days that fall on 29 February for some period

```julia
using Dates

dr = Date(2000,1,17):Day(1):Date(2020,1,17)
count(x -> monthday(x) == (2, 29), dr)

```

Also there’s:

```julia
isleapyear(2020)

```

This should address all of the complications of leap years (2020 is a leap year, 2100 is not, 2000 is)

---

_[View the full topic](https://discourse.julialang.org/t/dealing-with-leap-years/53516)._
