$date1 = "2020-01-01"; $date2 = "2022-05-31"; $years = dateYears::getDifference($date1, $date2); echo "The difference between $date1 and $date2 is $years years";
$birthdate = "1995-08-12"; $age = dateYears::calculateAge($birthdate); echo "The person's age is $age years";
$currentYear = dateYears::getCurrentYear(); echo "The current year is $currentYear";This code snippet uses the `getCurrentYear()` function provided by the dateYears package to get the current year. Overall, the PHP Tools dateYears package library provides functions for working with dates, enabling developers to perform various operations such as calculating the difference between two dates, calculating age, and getting the current year.