pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: scott.marlowe <scott.marlowe@ihs.com>
To: Grant Henderson <granth@fusion-advertising.co.uk>
Cc: pgsql-php@postgresql.org
Subject: Re: Date question
Date: Wed, 10 Sep 2003 07:55:32 -0600 (MDT)
Message-ID: <Pine.LNX.4.33.0309100750041.16181-100000@css120.ihs.com> (raw)
In-Reply-To: <31EA81C61A3D014F8D6933864F32C60413C8A2@server1.fusion-advertising.co.uk>

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.




view thread (4+ messages)  latest in thread

Message-ID: <Pine.LNX.4.33.0309100750041.16181-100000@css120.ihs.com>
Permalink:  ../Pine.LNX.4.33.0309100750041.16181-100000@css120.ihs.com/
Also on:    postgresql.org/message-id/Pine.LNX.4.33.0309100750041.16181-100000@css120.ihs.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: scott.marlowe@ihs.com, granth@fusion-advertising.co.uk
  Subject: Re: Date question
  In-Reply-To: <Pine.LNX.4.33.0309100750041.16181-100000@css120.ihs.com>
  References: <31EA81C61A3D014F8D6933864F32C60413C8A2@server1.fusion-advertising.co.uk> <Pine.LNX.4.33.0309100750041.16181-100000@css120.ihs.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