You can use the following function to subtract 1 or any years from the date.
function yearstodate($years) { $now = date("Ymd"); $now = explode('-', $now); $year = $now[0]; $month = $now[1]; $day = $now[2]; $converted_year = $year - $years; echo $now = $converted_year."-".$month."-".$day; } $number_to_subtract = "1"; echo yearstodate($number_to_subtract);
And looking above you can also use the following
$user_age_min = "-"."1"; echo date('Ym-d', strtotime($user_age_min.'year'));
user7796548 Aug 26 '17 at 11:37 on 2017-08-26 11:37
source share