phpretard Posted July 3, 2010 Share Posted July 3, 2010 I have this to set one limit on a calendar for today. I need another function that will return today() minus 18 years. function today(){ $current_date = date('Y-m-d'); return $current_date; } Can anyone help?? Thank you Link to comment https://forums.phpfreaks.com/topic/206616-today-minus-18-years-function/ Share on other sites More sharing options...
Mchl Posted July 3, 2010 Share Posted July 3, 2010 date('Y-m-d',strtotime('18 years ago')) Link to comment https://forums.phpfreaks.com/topic/206616-today-minus-18-years-function/#findComment-1080615 Share on other sites More sharing options...
coupe-r Posted July 3, 2010 Share Posted July 3, 2010 Would this work? $month = date("m"); $day = date("d"); $year = date("Y") - 18; $date = $year.'-'.$month.'-'.$day; Link to comment https://forums.phpfreaks.com/topic/206616-today-minus-18-years-function/#findComment-1080616 Share on other sites More sharing options...
phpretard Posted July 3, 2010 Author Share Posted July 3, 2010 Would this work? $month = date("m"); $day = date("d"); $year = date("Y") - 18; $date = $year.'-'.$month.'-'.$day; Thank you!!! function age_limit(){ $month = date("m"); $day = date("d"); $year = date("Y") - 18; $date = $year.'-'.$month.'-'.$day; return $date; } Link to comment https://forums.phpfreaks.com/topic/206616-today-minus-18-years-function/#findComment-1080618 Share on other sites More sharing options...
Mchl Posted July 3, 2010 Share Posted July 3, 2010 Whatever suits you... Link to comment https://forums.phpfreaks.com/topic/206616-today-minus-18-years-function/#findComment-1080625 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.