Mailinglisten-Archive |
Aloha,
> From: "Norbert Pfeiffer" <norbert at itbw.de>@phpbar.de on 05.08.2004
13:26 ZE2
> > <?php
> > $timestamp = strtotime('31.02.2005');
> > echo date('d.m.Y', $timestamp);
> > ?>
> > Warning: date() [function.date]: Windows does not support dates prior
to
> > midnight (00:00:00), January 1, 1970 in PHPDocument2 on line 3
> > Hat mich auch überrascht! :-)
> oops,
> noch ein Grund mehr gegen PHP5
das war auch schon bei PHP4 so:
C:\Dokumente und Einstellungen\gloss>type test.php4
<?
echo phpversion()."\r\n";
$timestamp = strtotime('31.02.2005');
echo '-->'.date('d.m.Y', $timestamp);
?>
C:\Dokumente und Einstellungen\gloss>test.php4
4.3.2-RC1
Warning: date() [http://www.php.net/function.date]: Windows does not
support dat
es prior to midnight (00:00:00), January 1, 1970 in C:\Dokumente und
Einstellung
en\gloss\test.php4 on line ...
*grübel* aber 2005 ist doch > 1970 ....
http://php.net/strtotime
Aha: strtotime(): The valid range of a timestamp is typically from Fri, 13 Dec 1901 20:45:54
GMT to Tue, 19 Jan 2038 03:14:07 GMT. (These are the dates that correspond
to the minimum and maximum values for a 32-bit signed integer.)
Und: Upon failure, -1 is returned.
*test* sihe da:
C:\Dokumente und Einstellungen\gloss>type test.php4
<?
echo phpversion()."\r\n";
$timestamp = strtotime('31.02.2005');
if ( $timestamp == -1 ) {
echo "ung³ltiges Datum\r\n";
}
?>
C:\Dokumente und Einstellungen\gloss>test.php4
4.3.2-RC1
ung³ltiges Datum
Also kein PHP-Problem sondern ein PROGRAMMIERER-Problem.
Grüße, Mathias
php::bar PHP Wiki - Listenarchive