Forum Moderators: coopster

Message Too Old, No Replies

Know how many days miss for the day X

         

romzinho2k7

8:07 pm on Feb 25, 2007 (gmt 0)

10+ Year Member



People would like their help

I want to do a script that I show me how many days miss for X. date I tried of the following form:

<?php
$date_today = date("m/d/Y");
$date_final = date("m/d/Y", mktime(0, 0, 0, 04, 20, 2007));
echo $data_final - $data_today;
?>

But the value always returned is zero.

Would anybody know how to do that?

Sorry my english.

Thanks

eelixduppy

8:30 pm on Feb 25, 2007 (gmt 0)



Hello,

You can't really subtract two strings. Instead, something like this would work:


$date_today = [url=http://us3.php.net/manual/en/function.time.php]time[/url](); #current time (if not use mktime)
$date_final = [url=http://us3.php.net/manual/en/function.mktime.php]mktime[/url](0, 0, 0, 4, 20, 2007);
$seconds = $date_final - $date_today;
echo ($seconds/86400).' days'; #86,400 seconds in one day

Good luck! :)

romzinho2k7

8:41 pm on Feb 25, 2007 (gmt 0)

10+ Year Member



:-)

Thanks brow.