Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 0DD46476874 for ; Wed, 6 Nov 2002 13:53:07 -0500 (EST) Received: from main.gmane.org (main.gmane.org [80.91.224.249]) by postgresql.org (Postfix) with ESMTP id 6DAF647684B for ; Wed, 6 Nov 2002 13:53:06 -0500 (EST) Received: from root by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 189VFd-0003ba-00 for ; Wed, 06 Nov 2002 19:50:05 +0100 To: pgsql-php@postgresql.org X-Injected-Via-Gmane: http://gmane.org/ Received: from news by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 189VDU-0003Q2-00 for ; Wed, 06 Nov 2002 19:47:52 +0100 Path: not-for-mail From: "David U." Subject: Re: Handling timestampz datatype Date: Wed, 6 Nov 2002 12:47:38 -0600 Lines: 24 Message-ID: References: <01fe01c285bf$72863140$4000000a@busbydev> NNTP-Posting-Host: 50rts37.wuh.wustl.edu X-Trace: main.gmane.org 1036608472 13145 128.252.50.37 (6 Nov 2002 18:47:52 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 6 Nov 2002 18:47:52 +0000 (UTC) X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200211/24 X-Sequence-Number: 1606 David Busby wrote: > List, > How are you all dealing with the timestampz data type in your > PG/PHP applications? I cannot seem to find the reliable way to deal > with them (for display purposes). My timestampz column comes into my > PHP script as a text string, I have to convert (using strtotime()) > first then use strftime() to format it. Any ideas on the easy way to > do this? It's a bit annoying, but I find this to work well: date("F j, Y, g:i a",strtotime('00'.$row['event_date'])) Obviously you can use whatever date scheme you want or strfttime like you said. (also, $row['event_date'] is my timestampz field, of course) I don't know of an easier way although it is probably possible to get the date out in epoch time direct from the SQL using the EPOCH keyword and some of the date functions. -davidu