pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Frank Bax <fbax@sympatico.ca>
To: pgsql-php@postgresql.org
Cc: Grant Henderson <granth@fusion-advertising.co.uk>
Subject: Re: Date question
Date: Wed, 10 Sep 2003 09:54:46 -0400
Message-ID: <5.2.1.1.0.20030910095139.00a11c60@pop6.sympatico.ca> (raw)
In-Reply-To: <31EA81C61A3D014F8D6933864F32C60413C8A2@server1.fusion-adve rtising.co.uk>

At 05:46 AM 9/10/03, 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);


The input to php "date" function is a unix timestamp, not a string.
Use:
         select date_part('epoch',order_date) from ...
instead of
         select order_date from ...





>---------------------------(end of broadcast)---------------------------
>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org




view thread (4+ messages)  latest in thread

Message-ID: <5.2.1.1.0.20030910095139.00a11c60@pop6.sympatico.ca>
Permalink:  ../5.2.1.1.0.20030910095139.00a11c60@pop6.sympatico.ca/
Also on:    postgresql.org/message-id/5.2.1.1.0.20030910095139.00a11c60@pop6.sympatico.ca

 · 

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: fbax@sympatico.ca, granth@fusion-advertising.co.uk
  Subject: Re: Date question
  In-Reply-To: <5.2.1.1.0.20030910095139.00a11c60@pop6.sympatico.ca>
  References: <5.2.1.1.0.20030910095139.00a11c60@pop6.sympatico.ca>

* 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