mflevie44 Posted September 28, 2013 Share Posted September 28, 2013 How can check This String '2013-09-12:14:00:01' is later than 24 hours of current time? Link to comment https://forums.phpfreaks.com/topic/282509-convert-sting-in-to-date/ Share on other sites More sharing options...
PaulRyan Posted September 28, 2013 Share Posted September 28, 2013 Edit* - Thought it was wrong function, actually malformed time string. <?PHP $string = '2013-09-27 14:00:01'; $timestamp = strtotime($string); if($timestamp < ($_SERVER['REQUEST_TIME'] - (60*60*24))) { echo 'True'; } ?> Link to comment https://forums.phpfreaks.com/topic/282509-convert-sting-in-to-date/#findComment-1451597 Share on other sites More sharing options...
Barand Posted September 28, 2013 Share Posted September 28, 2013 take a look at the DateTime class, particularly http://www.php.net/manual/en/datetime.createfromformat.php and http://www.php.net/manual/en/datetime.gettimestamp.php and http://www.php.net/manual/en/datetime.diff.php TIP: if you are going to post two different questions don't give the same title - one could get removed as a duplicate post Link to comment https://forums.phpfreaks.com/topic/282509-convert-sting-in-to-date/#findComment-1451600 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.