(top-posting!)
Add either the round function or ceil function.
On Mar 25, 2008, at 6:47 AM, Ron Piggott <[EMAIL PROTECTED]>
wrote:
Could someone then help me modify the PHP script so I won't have this
timezone issue? I don't understand from looking at the date page on
the
PHP web site the change(s) I need to make. Thanks, Ron
<?
$date1 = strtotime($date1);
$date2 = strtotime($date2);
$factor = 86400;
$difference = (($date1 - $date2) / $factor);
On Mon, 2008-03-24 at 07:24 -0700, Jim Lucas wrote:
Ron Piggott wrote:
I have this math equation this list helped me generate a few weeks
ago.
The purpose is to calculate how many days have passed between 2
dates.
Right now my output ($difference) is 93.9583333333 days.
I am finding this a little weird. Does anyone see anything wrong
with
the way this is calculated:
$date1 = strtotime($date1); (March 21st 2008)
$date2 = strtotime($date2); (December 18th 2007)
echo $date1 => 1206072000
echo $date2 => 1197954000
#86400 is 60 seconds x 60 minutes x 24 hours (in other words 1 days
worth of seconds)
$factor = 86400;
$difference = (($date1 - $date2) / $factor);
As Casey suggested, it is a timestamp issue.
Checkout my test script.
http://www.cmsws.com/examples/php/testscripts/[EMAIL PROTECTED]/0001.php
<plaintext><?php
$date1 = strtotime('March 21st 2008'); //(March 21st 2008)
echo "date1 = {$date1}\n";
$date2 = strtotime('December 18th 2007'); //(December 18th 2007)
echo "date2 = {$date2}\n";
$date1 = 1206072000;
echo date('c', $date1)."\n";
$date2 = 1197954000;
echo date('c', $date2)."\n";
#86400 is 60 seconds x 60 minutes x 24 hours (in other words 1 days
worth of
seconds)
$factor = 86400;
$difference = (($date1 - $date2) / $factor);
echo $difference."\n";
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php