Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-novice by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group