- Fixed bug #17988: strtotime fails to parse timestamp from postgresql

#- This is actually a feature request
This commit is contained in:
Derick Rethans 2003-08-16 20:55:28 +00:00
parent fe1a086d19
commit 77729f89dd
3 changed files with 55 additions and 0 deletions

1
NEWS
View File

@ -41,6 +41,7 @@ PHP NEWS
- Fixed bug #22367 (undefined variable has a value). (Zeev)
- Fixed bug #19859 (allow fast_call_user_function to support __call).
(Stanislav)
- Fixed bug #17988 (strtotime failed to parse postgresql timestamp). (Derick)
29 Jun 2003, PHP 5 Beta 1
- Removed the bundled MySQL client library. (Sterling)

View File

@ -228,6 +228,27 @@ time : tUNUMBER tMERIDIAN {
((struct date_yy *)parm)->yyTimezone = -$6 * 60;
}
}
| tUNUMBER ':' tUNUMBER ':' tUNUMBER '.' tUNUMBER pgsqlzonepart {
((struct date_yy *)parm)->yyHour = $1;
((struct date_yy *)parm)->yyMinutes = $3;
((struct date_yy *)parm)->yySeconds = $5;
((struct date_yy *)parm)->yyMeridian = MER24;
}
;
pgsqlzonepart : tSNUMBER {
((struct date_yy *)parm)->yyHaveZone++;
if ($1 <= -100 || $1 >= 100) {
((struct date_yy *)parm)->yyTimezone =
-$1 % 100 + (-$1 / 100) * 60;
} else {
((struct date_yy *)parm)->yyTimezone = -$1 * 60;
}
}
| zone {
((struct date_yy *)parm)->yyHaveZone++;
}
| /* empty */
;
zone : tZONE {

View File

@ -0,0 +1,33 @@
--TEST--
Bug #17988 strtotime handling of postgresql timestamps
--FILE--
<?php
putenv("TZ=GMT");
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728 GMT"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728 MET"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728 MEST"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728 EDT"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728-00"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728+00"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728-04"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728+04"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728-0300"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728+0300"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728-0330"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728+0330"))."\n";
?>
--EXPECT--
2002-06-25 14:18:48
2002-06-25 14:18:48
2002-06-25 13:18:48
2002-06-25 12:18:48
2002-06-25 18:18:48
2002-06-25 14:18:48
2002-06-25 14:18:48
2002-06-25 18:18:48
2002-06-25 10:18:48
2002-06-25 17:18:48
2002-06-25 11:18:48
2002-06-25 17:48:48
2002-06-25 10:48:48