pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robby Russell <rrussell@commandprompt.com>
To: Grant Henderson <granth@fusion-advertising.co.uk>
Cc: pgsql-php@postgresql.org
Subject: Re: Date question
Date: Wed, 10 Sep 2003 07:32:48 -0700
Message-ID: <3F5F3610.60408@commandprompt.com> (raw)
In-Reply-To: <31EA81C61A3D014F8D6933864F32C60413C8A2@server1.fusion-advertising.co.uk>
References: <31EA81C61A3D014F8D6933864F32C60413C8A2@server1.fusion-advertising.co.uk>

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




view thread (4+ messages)

Message-ID: <3F5F3610.60408@commandprompt.com>
Permalink:  ../3F5F3610.60408@commandprompt.com/
Also on:    postgresql.org/message-id/3F5F3610.60408@commandprompt.com

 · 

reply

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: rrussell@commandprompt.com, granth@fusion-advertising.co.uk
  Subject: Re: Date question
  In-Reply-To: <3F5F3610.60408@commandprompt.com>
  References: <31EA81C61A3D014F8D6933864F32C60413C8A2@server1.fusion-advertising.co.uk> <3F5F3610.60408@commandprompt.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