pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: Thomas Good <tomg@sqlclinic.net>
To: Postgres SQL <pgsql-sql@postgreSQL.org>
Subject: Re: Formatting current_time output
Date: Thu, 03 Oct 2002 08:03:06 -0700
Message-ID: <web-1770248@davinci.ethosmedia.com> (raw)
In-Reply-To: <Pine.LNX.4.33.0210031041060.11566-100000@q8.nrnet.org>

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




view thread (6+ messages)  latest in thread

Message-ID: <web-1770248@davinci.ethosmedia.com>
Permalink:  ../web-1770248@davinci.ethosmedia.com/
Also on:    postgresql.org/message-id/web-1770248@davinci.ethosmedia.com

 · 

reply

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: josh@agliodbs.com, tomg@sqlclinic.net
  Subject: Re: Formatting current_time output
  In-Reply-To: <web-1770248@davinci.ethosmedia.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