Reply to unusual behaviour of strtotime() for '0000-00-00 00:00:00' input

Your name:

Reply:


Posted by Rithish on 04/21/06 18:30

Hello. I noticed a strange thing while using strtotime() and date()
functions in combination to generate from MySQL into a readable format.

By default, the MySQL date field will be 0000-00-00 00:00:00 When I
pass this to strtotime() to generate the timestamp, and then pass it to
the date function, it generates 30-11-1999.

[snippet]
<?
print ( "<br> strtotime for '0000-00-00 00:00:00' : " . strtotime (
'0000-00-00 00:00:00' ) );
print ( "<br> date for the above : " . date ( "d-m-Y", strtotime (
'0000-00-00 00:00:00' ) ) );
?>
[/snippet]

I am on PHP 5.0.2
Why this unusual behaviour? Or is it an expected behaviour?

Suggestions/comments/flamings solicited.

Regards,
Rithish.

[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

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