Forum Moderators: coopster

Message Too Old, No Replies

strtotime() doesn't like me

no matter what Postgres date format

         

dingman

12:27 am on Jan 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've got a little routine, which used to work, which takes a Postgres timestamp from a database, converts it to a Unix timestamp, does some math, and decides how it wants to format the date based on how long ago the event occurred. Unfortunately, without any change to my code, the strtotime() function doesn't work any more. I've tried setting Postgres' date output format to every value in the book, and none of them convert sucessfully. Anyone have any ideas?

php 4.2.3
Postgres 7.3

jatar_k

6:20 pm on Jan 2, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



did anything else change? Did the ISP change some setting or upgrade something? I assume Postgre is still sending the proper time.

I also assume you looked at formats here
[php.net...]
[gnu.org...]

I am really not sure, you would think something somewhere has changed.

lorax

1:35 am on Jan 3, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I've been rereading your post several times today and still haven't come up with a plausible answer. Have you tested the output of strtotime() to see what you're actually getting for a var type?

dingman

3:32 am on Jan 3, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



*something* clearly changed, since the output did. And as I do my own hosting right here in my study, I can't lay the blame very far from myself :) My best guess is that is has to do with my recent Postgres update - I think it worked with php 4.2.3 before that, but it's a development copy of the code on a machine that tracks Debian 'unstable', and I haven't worked on it for a few weeks.

Yup, those were the first two places I looked.

strtotime() was returning -1, which is its way of saying that its input didn't look like any kind of time to it.

I have dealt with the problem by passing the ISO format time from Postgres through a regular expression that strips off the fractional part of the seconds. No great loss, since my readable_time() function never prints anything more precise than the minute. It doesn't answer the question of why it stopped working very well, but it addresses the issue anyway.

lorax

2:14 pm on Jan 3, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I just visited the American mirror site to see what the release history was and noted they haven't posted the info for the Postgres 7.3. Perhaps when it comes out you'll be able to learn what changed.