Reply to PHP Time Bug

Your name:

Reply:


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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация