Posted by Tomas on 02/03/06 00:01
I have a very interesting problem...
Php says that the difference between these times is 1 hour.
<?php
$t1 = "2005-12-31 20:00";
$t2 = "2005-12-31 20:00";
$t1i = strtotime($t1);
$t2i = strtotime($t2);
$diff = abs($t1i - $t2i);
print_r(getdate($diff));
?>
The Output:
Array
(
[seconds] => 0
[minutes] => 0
[hours] => 1
[mday] => 1
[wday] => 4
[mon] => 1
[year] => 1970
[yday] => 0
[weekday] => Thursday
[month] => January
[0] => 0
)
Can you please suggest something how to calculate the difference
between 2 datetimes?
And another question, a bit off-topic, but how do I get the number of
days of a month with taking leap years in consideration?
Thanks in advence.
Tomas
Navigation:
[Reply to this message]
|