Re: Formatting current_time output - Mailing list pgsql-sql

From Josh Berkus
Subject Re: Formatting current_time output
Date
Msg-id web-1770248@davinci.ethosmedia.com
Whole thread Raw
In response to Formatting current_time output  (Thomas Good <tomg@sqlclinic.net>)
Responses Re: Formatting current_time output
Re: Formatting current_time output
List 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



pgsql-sql by date:

Previous
From: Roberto Mello
Date:
Subject: epoch to date
Next
From: Achilleus Mantzios
Date:
Subject: Re: Formatting current_time output