/ Published in: PHP
![](/img/icon_sav.png?v3)
Examine a date and return false if it's in the past, or true for the future.
Slightly more complicated than it needs to be, however there's an easy tutorial with full explanation if you follow the attached link.
Slightly more complicated than it needs to be, however there's an easy tutorial with full explanation if you follow the attached link.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function checkDateAndTime($day,$month,$year,$hour,$minute) { $dateForConverting = $day."-".$month."-".$year."@".$hour.":".$minute; $formattedDate = date_create_from_format("j-n-Y@G:i", $dateForConverting); $returnBool = true; $diffInSecs = $newDateInSecs - $nowInSecs; if($diffInSecs < 0) { $returnBool = false; } return $returnBool; }
URL: http://gromitski.com/blog/checking-if-a-date-is-in-the-past-or-the-future-php/
Comments
![RSS Feed for Comments RSS Icon](/images/rss.png?v3)