Re: Padding time values from EXTRACT()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Mark Kelly <pgsql(at)wastedtimes(dot)net>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Padding time values from EXTRACT()
Date: 2009-11-19 00:37:23
Message-ID: 376.1258591043@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Mark Kelly <pgsql(at)wastedtimes(dot)net> writes:
> If I use the following snippet

> EXTRACT (hour FROM timestamp) || ':' ||
> EXTRACT (minute FROM timestamp)
> AS this_time

Use to_char() for this sort of thing. Something like
to_char(now(), 'HH24:MM') is probably what you want here.

regards, tom lane

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Mark Kelly 2009-11-19 00:42:26 Re: Padding time values from EXTRACT()
Previous Message Mark Kelly 2009-11-19 00:15:38 Padding time values from EXTRACT()