Re: strtotime() and postgresql date/time output

From: Timothy_Maguire(at)hartehanks(dot)com
To: Rien Broekstra <rien(at)cal018043(dot)student(dot)utwente(dot)nl>
Cc: pgsql-php(at)postgresql(dot)org
Subject: Re: strtotime() and postgresql date/time output
Date: 2001-01-29 15:14:47
Message-ID: OF36D11778.101291A7-ON852569E3.0052597C@hartehanks.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-php


When I pull a timestamp from a db, i use the to_char () postgresql
function. This is real nice because you can convert the months into words
(Jan or January). Try something like this:

SELECT to_char(timestamp_field, "M") from table;

I forget the exact syntax, but you can find it at postgresql.org under the
users guide.

TIm.

Rien Broekstra <rien(at)cal018043(dot)student(dot)utwente(dot)nl>@postgresql.org on
01/27/2001 06:39:42 AM

Sent by: pgsql-php-owner(at)postgresql(dot)org

To: pgsql-php(at)postgresql(dot)org
cc:

Subject: strtotime() and postgresql date/time output

I have the following problem

I want to save timestamps in a database and use them in a php script.

According to the documentation, postgres's date/time output is possible
in 4 styles. My problem is that the php strtotime() function which I use
to get a timestamp instead of a date/time string does not understand any
of these date/time formats.

- Is it possible to manually define a datestyle so Postgresql returns a
date/time string which strtotime does understand?
- Is it possible to let Postgresql return just a timestamp instead of a
date/time string
- Is there another function in php which does understand standard ISO or
SQL style date/time strings and converts them to a timestamp?

thanks in advance
--
Rien Broekstra a.k.a Rienzilla
ICQ: 35629366 The Drunk Snipers: unreal.snt.utwente.nl
Mail: rien(at)rename-it(dot)student(dot)utwente(dot)nl
Vestingbar: www.vestingbar.nl

Browse pgsql-php by date

  From Date Subject
Next Message Julio Cuz, Jr. 2001-02-05 17:25:11 Lowercase problem
Previous Message Rien Broekstra 2001-01-27 11:39:42 strtotime() and postgresql date/time output