Skip to content Skip to footer navigation

Years Ago Modifier

Returns the number of years since a given date variable. Statamic will attempt to parse any string as a date, but try to keep it in the least ambiguous date format possible.

# Assuming the current date is June 19, 2023.
date: June 19 2012
{{ date | years_ago }}
{{ Statamic::modify($date)->yearsAgo() }}
11