Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 157444761B7 for ; Thu, 3 Oct 2002 11:22:56 -0400 (EDT) Received: from clearmetrix.com (unknown [209.92.142.67]) by postgresql.org (Postfix) with ESMTP id 65CBE476130 for ; Thu, 3 Oct 2002 11:22:55 -0400 (EDT) Received: from clearmetrix.com (chw.muvpn.clearmetrix.com [172.16.1.3] (may be forged)) by clearmetrix.com (8.11.6/linuxconf) with ESMTP id g93FMmV14886; Thu, 3 Oct 2002 11:22:48 -0400 Message-ID: <3D9C60C8.5070601@clearmetrix.com> Date: Thu, 03 Oct 2002 11:22:48 -0400 From: "Charles H. Woloszynski" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.1) Gecko/20020826 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Josh Berkus Cc: Thomas Good , Postgres SQL Subject: Re: Formatting current_time output References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/39 X-Sequence-Number: 9757 On 7.2.2, you can use select to_char(now(), 'HH12:MI AM'); (using current_time raises an error, but now() works fine). Charlie Josh Berkus wrote: >Thomas, > > > >>SELECT TO_CHAR(SYSDATE,'HH:MI AM') FROM DUAL; -- Oracle >>SELECT TIME_FORMAT(current_time,'%l:%i %p'); -- MySQL >> >>Returned: 10:58 AM >> >>I've found lpad(current_time,5); which gets me 1/3 of the way. >>Is there a function I haven't found? >> >> > >Um, what's wrong with: >SELECT to_char(current_time, 'HH12:MI AM'); >? > >(See "Formatting Functions" under "Functions and Operators" in the >User's Guide) > >-Josh Berkus > > >---------------------------(end of broadcast)--------------------------- >TIP 5: Have you checked our extensive FAQ? > >http://www.postgresql.org/users-lounge/docs/faq.html > > -- Charles H. Woloszynski ClearMetrix, Inc. 115 Research Drive Bethlehem, PA 18015 tel: 610-419-2210 x400 fax: 240-371-3256 web: www.clearmetrix.com