Received: from web13002.mail.yahoo.com (web13002.mail.yahoo.com [216.136.174.12]) by postgresql.org (8.11.3/8.11.4) with SMTP id f86FEQ786415 for ; Thu, 6 Sep 2001 11:14:26 -0400 (EDT) (envelope-from bmatzelle@yahoo.com) Message-ID: <20010906151422.84441.qmail@web13002.mail.yahoo.com> Received: from [146.145.232.35] by web13002.mail.yahoo.com via HTTP; Thu, 06 Sep 2001 08:14:22 PDT Date: Thu, 6 Sep 2001 08:14:22 -0700 (PDT) From: "Brent R. Matzelle" Subject: Re: Date calc/comparisions To: pgsql-php@postgresql.org In-Reply-To: <003d01c13688$be7c8bd0$f8165dd8@mitch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Archive-Number: 200109/3 X-Sequence-Number: 524 --- Mitch Vincent wrote: > You could do > > SELECT EXTRACT(EPOCH FROM ); > > -- To get epoch, then use PHP to do the date calculation.. You > could do the > calculation in the database too, though.. > > Check out > http://postgresql.crimelabs.net/users-lounge/docs/7.1/user/functions-datetim > e.html Thanks for the response. Actually I found a slightly better way of accomplishing the same thing last night. I can change the PostgreSQL TIMESTAMP to a PHP viable Unix timestamp by eliminating the time zone stuff from the end of the string: $timestamp = "2001-09-05 21:12:45-04" // simulate a PG timestamp // Eliminates the "-04" $timestamp = substr($timestamp, 0, -3); $unix_time = strtotime($timestamp); // Now I can convert it: $pretty_time = date("Y M d H:i", $unix_time); Regards, Brent __________________________________________________ Do You Yahoo!? Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger http://im.yahoo.com