Re: PHP & PostgreSQL

From: Date: Mon, 30 Dec 2002 14:33:12 +0000
Subject: Re: PHP & PostgreSQL
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-129668@lists.php.net to get a copy of this message
On Monday 30 December 2002 21:57, Chris Boget wrote: > > >o Pg doesn't have DATE_FORMAT() > > > > to_char() accomplishes the same thing, for example: > > select to_char(lastlogin, 'FMMM-DD-YYYY FMHH:MI AM') as lastloginf > > from users; > > Unless I missed something, that function doesn't work with unix timestamps. No, it only works on pg's date/time formats. > Is there anythin internal to PG that allows you to convert to and from unix > timestamps? Best to store date/time in pg's format rather than unix timestamp. If you've got legacy data which are stored as unix timestamps then you can do one of the following: 1) Do a one time conversion from unix timestamp to pg date/time 2) Manipulate the dates in PHP instead 3) Write your own function in pg to convert them on the fly -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Griffin's Thought: When you starve with a tiger, the tiger starves last. */

« previous php.general (#129668) next »