From: Charles H. Woloszynski <chw@clearmetrix.com>
To: Josh Berkus <josh@agliodbs.com>
Cc: Thomas Good <tomg@sqlclinic.net>
Cc: Postgres SQL <pgsql-sql@postgresql.org>
Subject: Re: Formatting current_time output
Date: Thu, 03 Oct 2002 11:22:48 -0400
Message-ID: <3D9C60C8.5070601@clearmetrix.com> (raw)
References: <web-1770248@davinci.ethosmedia.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: chw@clearmetrix.com, josh@agliodbs.com, tomg@sqlclinic.net
Subject: Re: Formatting current_time output
In-Reply-To: <3D9C60C8.5070601@clearmetrix.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox