Forum Moderators: coopster
<?php
$cdate = mktime(0, 0, 0, 12, 31, 2009, 0);
$today = time();
$difference = $cdate - $today;
if ($difference < 0) { $difference = 0; }
echo "There are ". floor($difference/60/60/24)." days remaining";
?>
This seems to work great if I could hard-code each part of my date into the mktime function, but in my situation I have a date stored in YYYY-MM-DD format in a variable called $CountDate. Is there a way to convert a date format into something that will work as an input to mktime()? Is there some other way to calculate the number of days remaining?