Comparing dates with PHP

Ahmad Alfy 27th of April 2012

$exp_date = "2006-01-16";
$todays_date = date("Y-m-d");

$today = strtotime($todays_date);
$expiration_date = strtotime($exp_date);

if ($expiration_date > $today) {
     $valid = "yes";
} else {
     $valid = "no";
}
168
Views
0
Comments
1
Downloads
Comments
Only Code Pad members can post comments!

Want to join Code Pad Request An Invite
    No Comments Posted

Suppo - Create, Customize & Host
Your App Support Page at Suppo

Snippet Details

Keyboard Shortcuts

DDownload

TTweet

FFull View

Next Snippet

Previous Snippet