dadamssg Posted March 19, 2009 Share Posted March 19, 2009 what will strtotime output if one puts in a nonexisting date? im attempting to program an age calculator but dont want to use mktime because it will make feb 29 as mar 1st. i want to recognize non existent dates and don't know how to incorporate checkdate() with if statements...thanks Link to comment https://forums.phpfreaks.com/topic/150189-strtotimefeb-31-2009/ Share on other sites More sharing options...
MadTechie Posted March 19, 2009 Share Posted March 19, 2009 depends on your inputs but try checkdate() Description bool checkdate ( int $month , int $day , int $year ) Checks the validity of the date formed by the arguments. A date is considered valid if each parameter is properly defined. Link to comment https://forums.phpfreaks.com/topic/150189-strtotimefeb-31-2009/#findComment-788748 Share on other sites More sharing options...
dadamssg Posted March 19, 2009 Author Share Posted March 19, 2009 so how would i wrap that in an if statement? im not sure what the checkdate will return and how many equal signs to put, etc. if( bool checkdate( int $month, int $day, int $year ) === false) { echo "the date you selected is non existent, dumbass"; } Link to comment https://forums.phpfreaks.com/topic/150189-strtotimefeb-31-2009/#findComment-788755 Share on other sites More sharing options...
MadTechie Posted March 19, 2009 Share Posted March 19, 2009 try this $day=30; $month = 2; $year=2009; if(!checkdate($month, $day, $year)) { echo "the date you selected is non existent, dumbass"; } Link to comment https://forums.phpfreaks.com/topic/150189-strtotimefeb-31-2009/#findComment-788758 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.