Re: EASY!!! Timestamp conversion & php

From: Jason Earl <jason(dot)earl(at)simplot(dot)com>
To: eric(dot)jones(at)hua(dot)army(dot)mil
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: EASY!!! Timestamp conversion & php
Date: 2002-06-05 18:49:39
Message-ID: 87660x5zng.fsf@npa01zz001.simplot.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


I couldn't help but answer an email that starts:

CLASSIFICATION: UNCLASSIFIED

What you need to do is take a look at the to_char function in Chapter
4.7 of the PostgreSQL User's Guide.

For example if you wanted to get the current timestamp in the format
you specified you would need to do something like:

SELECT to_char(CURRENT_TIMESTAMP, 'FMMonth FMDD, YYYY HH24:MI');

Jason

eric(dot)jones(at)hua(dot)army(dot)mil writes:

> CLASSIFICATION: UNCLASSIFIED
>
> Can anyone tell me how to convert this PG timestamptz: 2002-06-05
> 10:39:02.480922-07
>
> To June 5, 2002 10:39
>
> I try this code:
>
> <?=date("M j, Y",strtotime(2002-06-05 10:39:02.480922-07))?>
>
> And I get Dec 31, 1969 so I know it's not working....
>
> Help!!!
>
> Eric Jones (Contractor)
> FDIC Web Enabler
> E-mail: jonese(at)hua(dot)army(dot)mil
> Office - 520-533-6628
> Cell - 520-980-2136
> Email Pager - 5209802136(at)messaging(dot)nextel(dot)com
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Neil Conway 2002-06-05 19:31:01 Re: Insight into indexes? (or inverting then externally)
Previous Message eric.jones 2002-06-05 18:15:02 EASY!!! Timestamp conversion & php