Get First / Last Day of a Year

first_of_year(x)

# S3 method for date_xx
first_of_year(x)

# S3 method for integer
first_of_year(x)

# S3 method for default
first_of_year(x)

# S3 method for numeric
first_of_year(x)

last_of_year(x)

# S3 method for date_xx
last_of_year(x)

# S3 method for integer
last_of_year(x)

# S3 method for default
last_of_year(x)

# S3 method for numeric
last_of_year(x)

Arguments

x

Anything that can be coerced to a date with base::as.Date()

Value

a Date

Examples

first_of_year("2016-06-04")
#> [1] "2016-01-01"
last_of_year("2016-06-04")
#> [1] "2016-12-31"