Re: Date question

From: Robby Russell <rrussell(at)commandprompt(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 14:32:48
Message-ID: 3F5F3610.60408@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)commandprompt(dot)com | Telephone: (503) 222.2783

In response to

Browse pgsql-php by date

  From Date Subject
Next Message Tran Anh Tu 2003-09-11 10:22:07 Help me
Previous Message scott.marlowe 2003-09-10 13:55:32 Re: Date question