Re: Date question

From: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
To: Grant Henderson <granth(at)fusion-advertising(dot)co(dot)uk>
Cc: <pgsql-php(at)postgresql(dot)org>
Subject: Re: Date question
Date: 2003-09-10 13:55:32
Message-ID: Pine.LNX.4.33.0309100750041.16181-100000@css120.ihs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

On Wed, 10 Sep 2003, Grant Henderson wrote:

> How do I convert a postrgesql timestamp
> To an english date
>
> E.g.
> $order_date = "2003-09-10 09:40:30+01";
> $date = date("d/M/Y", $order_date);
> print($date);

You can either split out the parts and use mktime to get a timestamp, then
feed that timestamp to date(), or you can do it in postgresql with
something like SET DateStyle TO 'US' and then see how they come out.

Finally, you could use the extract() function to pull the date in the
format you want ahead of time:

select extract(YEAR from field)||'/'||extract(MONTH from
field)||'/'||extract(day from field);

And get it that way.

In response to

Browse pgsql-php by date

  From Date Subject
Next Message Robby Russell 2003-09-10 14:32:48 Re: Date question
Previous Message Frank Bax 2003-09-10 13:54:46 Re: Date question