date - php strtotime does not work -
i got issue on below script, assume $exp_date
retrieved db, want compare expiry date today date check whether membership's still alive.
there nothing display time expired
, what's wrong code?
the data retrieved expiry column in db set varchar (which built ex-colleague).
$exp_date = "22/01/2014"; $todays_date = date("d/m/y"); $today = strtotime($todays_date); $expiration_date = strtotime($exp_date); echo $expiration_date.' | '.$today.'<br>'; if($expiration_date > $today){ echo 'still active'; } else { echo 'time expired'; }
anyone can with?
here working code
<?php $exp_date = "22/01/2014"; $exp_date = str_replace('/', '-', $exp_date); $todays_date = date("d-m-y"); $today = strtotime($todays_date); $expiration_date = strtotime($exp_date); echo $expiration_date.' | '.$today.'<br>'; if($expiration_date > $today){ echo 'still active'; } else { echo 'time expired'; } ?>
actually strtotime() not work format 'd/m/y'
hope helps you.
Comments
Post a Comment