Re: Date question - Mailing list pgsql-php

From Robby Russell
Subject Re: Date question
Date
Msg-id 3F5F3610.60408@commandprompt.com
Whole thread Raw
In response to Date question  ("Grant Henderson" <granth@fusion-advertising.co.uk>)
List pgsql-php
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);
>

Why not just do it in the database before you get to the PHP?


=# SELECT to_char(now(), 'Month-fmdd-yyyy'::text);

       to_char
-------------------
  September-10-2003
(1 row)


More info:

http://www.postgresql.org/docs/7/interactive/functions2976.htm

Hope that can help,

-Robby





--
Robby Russell,  |  Sr. Administrator / Lead Programmer
Command Prompt, Inc.   |  http://www.commandprompt.com
rrussell@commandprompt.com | Telephone: (503) 222.2783


pgsql-php by date:

Previous
From: "scott.marlowe"
Date:
Subject: Re: Date question
Next
From: "Tran Anh Tu"
Date:
Subject: Help me