# Getting the third Friday of the month

**URL:** https://discourse.julialang.org/t/getting-the-third-friday-of-the-month/56787
**Category:** General Usage
**Tags:** question, dates
**Created:** [March 9, 2021, 6:13am UTC](https://discourse.julialang.org/t/getting-the-third-friday-of-the-month/56787 "2021-03-09T06:13:41Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![lungben](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lungben/32/12314_2.png) [@lungben](https://discourse.julialang.org/u/lungben)
#### Post date: [March 9, 2021, 8:32am UTC](https://discourse.julialang.org/t/getting-the-third-friday-of-the-month/56787/4 "2021-03-09T08:32:34Z")

</div>

Here is another possibility:

```julia
function get_next_expiry(calc_date:: Date, month:: Integer; holidays:: AbstractArray = [])
    # get 3rd Wednesday of the corresponding month
    expiry_date = Dates.tonext(calc_date + Month(month-1)) do x
       Dates.dayofweek(x) == Dates.Friday && Dates.dayofweekofmonth(x) == 3
    end
    # move to next business day if the day is a holiday - not sure if you need this
    Dates.tonext(expiry_date, same=true) do x
        isbusday(x, holidays=holidays)
    end
end

# get the next 300 3rd Fridays, shifted to next business day if required
expiry_dates = get_next_expiry.(START_DATE, 1:300; holidays=target_holidays)

```

---

_[View the full topic](https://discourse.julialang.org/t/getting-the-third-friday-of-the-month/56787)._
