in this article, we will learn how to extract the year from the date in PHP


Example:

<?php
echo date('Y', strtotime('2021-01-17'));
?>


Output:

2021