|
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.
Navigation:
[Reply to this message]
|