From: Brent R. Matzelle <bmatzelle@yahoo.com>
To: pgsql-php@postgresql.org
Subject: Re: Date calc/comparisions
Date: Thu, 6 Sep 2001 08:14:22 -0700 (PDT)
Message-ID: <20010906151422.84441.qmail@web13002.mail.yahoo.com> (raw)
In-Reply-To: <003d01c13688$be7c8bd0$f8165dd8@mitch>
--- Mitch Vincent <mvincent@cablespeed.com> wrote:
> You could do
>
> SELECT EXTRACT(EPOCH FROM <timestamp>);
>
> -- 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-php@postgresql.org
Cc: bmatzelle@yahoo.com
Subject: Re: Date calc/comparisions
In-Reply-To: <20010906151422.84441.qmail@web13002.mail.yahoo.com>
References: <003d01c13688$be7c8bd0$f8165dd8@mitch> <20010906151422.84441.qmail@web13002.mail.yahoo.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox