next_date: Find the next date

View source: R/utils.R

next_dateR Documentation

Find the next date

Description

Given a date and a day of the week, Given a date return the next month's first Tuesday

Usage

next_date(month, which = "Tues", n = 1)

Arguments

month

Character/Date. The current month. Date returned is the next month.

which

Character/Numeric. Which week day to return. Either number or abbreviated English weekday.

n

Numeric. The nth week to return (i.e. the 1st Tuesday if n = 1 and which = "Tues").

Value

A date

Examples


# Get the next first Tuesday
next_date("2023-11-01")
next_date("2023-11-30")

# Get the next 3rd Tuesday
next_date("2023-11-01", n = 3)

# Oops
## Not run: 
next_date("2023-11-01", n = 5)

## End(Not run)


ropensci-org/promoutils documentation built on Nov. 29, 2024, 7:17 p.m.