|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #17988 strtotime fails to parse timestamp type from postgresql
Submitted: 2002-06-26 00:35 UTC Modified: 2003-08-16 15:56 UTC
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: jam at newimage dot com Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.1.2 OS: redhat 7.3
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: jam at newimage dot com
New email:
PHP Version: OS:


 [2002-06-26 00:35 UTC] jam at newimage dot com
- postgresql 7.2.1

- php 4.1.2

- redhat 7.3 with all applicable patches

- field type: timestamp

- strtotime() fails to parse dates of the form "2002-06-25    14:18:48.543728-04" because parsedate.y doesn't know how to        handle a floating point seconds value.

- according to #postgresql, it is not possible to have a timestamp not print the precision, so the issue needs to be handled by php's parsedate.y.

- any other details needed, let me know.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-26 00:50 UTC] jam at newimage dot com
I am attempting to extract a timestamp field from the database and convert it to a php time value. the issue is the value that postgresql hands out for the date-- it contains floating point numbers which parsedate.y doesn't know how to handle.
 [2002-06-26 00:52 UTC]
Please go read the docs at the links I supplied.
 [2002-06-26 00:58 UTC] jam at newimage dot com
I have read the docs :)

maybe I've missed something (happens all the time).. could you suggest a way to do what I want without using strtotime()?

I'm missing something.. is there a way to extract the entire date/time string with postgresql functions?
 [2002-06-26 01:05 UTC] jam at newimage dot com
ok. while I believe parsedate.y needs to be updated to handle floating point seconds values (I've done it, it's not hard to patch), I *do* see the value of the documentation you pointed out, and I think I can get the code to work.

thank you for your help.
 [2002-06-26 01:26 UTC]
Please submit that patch then so we can include it.

 [2002-06-27 14:52 UTC] jam at newimage dot com
--- parsedate.y.old	Thu Jun 27 14:26:11 2002
+++ parsedate.y	Thu Jun 27 14:43:28 2002
@@ -262,4 +262,13 @@
+	    yyHour = $1;
+	    yyMinutes = $3;
+	    yySeconds = $5;
+	    yyMeridian = MER24;
+	    yyDSTmode = DSToff;
+	    yyTimezone = - ($8 % 100 + ($8 / 100) * 60);
+	}
 [2002-06-27 15:08 UTC] jam at newimage dot com
the above patch was generated against php-4.2.1
 [2002-07-02 09:34 UTC]
Assigned to Derick. He mumbled something about rewrite..

 [2003-08-16 15:56 UTC]
Finally fixed in CVS (PHP 5). The patch included didn't work at all anymore, so I came up with my own version. I might merge this to PHP 4.3.4, but after PHP 4.3.3 has been released.

 [2010-03-07 20:13 UTC]
Automatic comment from SVN on behalf of derick
Log: - Re-generate mapping files, but now with BC zones as well.
#- Fixes the test case for bug #17988 that used a few of those.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 15:01:29 2024 UTC