Thread: EASY!!! Timestamp conversion & php

EASY!!! Timestamp conversion & php

From
eric.jones@hua.army.mil
Date:
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@hua.army.mil
Office - 520-533-6628
Cell - 520-980-2136
Email Pager - 5209802136@messaging.nextel.com

Re: EASY!!! Timestamp conversion & php

From
Jason Earl
Date:
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.jones@hua.army.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@hua.army.mil
> Office - 520-533-6628
> Cell - 520-980-2136
> Email Pager - 5209802136@messaging.nextel.com
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

Re: EASY!!! Timestamp conversion & php

From
eric.jones@hua.army.mil
Date:
CLASSIFICATION: UNCLASSIFIED

Thanks! That worked perfectly... I'll be sure to brush up on that chapter :)

FYI, I work for the US Army as a contractor and they require that I classify
each email I send out.... :)

Eric Jones (Contractor)
FDIC Web Enabler
E-mail: jonese@hua.army.mil
Office - 520-533-6628
Cell - 520-980-2136
Email Pager - 5209802136@messaging.nextel.com

-----Original Message-----
From: Jason Earl [mailto:jason.earl@simplot.com]
Sent: Wednesday, June 05, 2002 11:50 AM
To: eric.jones@hua.army.mil
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] EASY!!! Timestamp conversion & php



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.jones@hua.army.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@hua.army.mil
> Office - 520-533-6628
> Cell - 520-980-2136
> Email Pager - 5209802136@messaging.nextel.com
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster