Re: Formatting current_time output

From: "Josh Berkus" <josh(at)agliodbs(dot)com>
To: Thomas Good <tomg(at)sqlclinic(dot)net>, Postgres SQL <pgsql-sql(at)postgreSQL(dot)org>
Subject: Re: Formatting current_time output
Date: 2002-10-03 15:03:06
Message-ID: web-1770248@davinci.ethosmedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Roberto Mello 2002-10-03 15:09:27 epoch to date
Previous Message Thomas Good 2002-10-03 14:46:19 Formatting current_time output