Jump to content

Date Help Please


phpretard

Recommended Posts

This work for adding 18 years but not subtracting...

 

function select_yr(){ // WORKS
$stopy = (int)date('Y') + 18;
for($y = date('Y'); $y < $stopy; $y++){
  echo '<option value="'.$y.'">'.$y.'</option>';

}
}


function select_yr(){ // DOES NOT WORK
$stopy = (int)date('Y') - 18;
for($y = date('Y'); $y < $stopy; $y++){
  echo '<option value="'.$y.'">'.$y.'</option>';

}
}

 

Any help?

 

Thank you

Link to comment
https://forums.phpfreaks.com/topic/206621-date-help-please/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.