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

Re: Formating Date Data Type?

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Ashish Karalkar <ashish(dot)karalkar(at)info-spectrum(dot)com>
Cc: Cesar Alvarez <c(dot)alvarezx66(at)gmail(dot)com>, pgsql-novice(at)postgresql(dot)org, Phillip Smith <phillip(dot)smith(at)weatherbeeta(dot)com(dot)au>
Subject: Re: Formating Date Data Type?
Date: 2007-03-21 14:40:37
Message-ID: 20070321144037.GA57953@winnie.fuhr.org (view raw or flat)
Thread:
Lists: pgsql-novice
On Wed, Mar 21, 2007 at 12:35:35PM +0530, Ashish Karalkar wrote:
> Tried with to_char but it does not take column name/actuall date
> value  as argument for date

Please show exactly what you tried and what the result was.  Does
the following help?

test=> create table test (d date);
CREATE TABLE
test=> insert into test values ('2007-04-15');
INSERT 0 1
test=> select to_char(d, 'DD-Mon-YYYY') from test;
   to_char   
-------------
 15-Apr-2007
(1 row)

test=> select to_char('2007-4-15'::date, 'DD-Mon-YYYY');
   to_char   
-------------
 15-Apr-2007
(1 row)

-- 
Michael Fuhr

In response to

Responses

pgsql-novice by date

Next:From: Michael FuhrDate: 2007-03-21 14:48:30
Subject: Re: CHAR data type
Previous:From: LeticiaDate: 2007-03-21 14:29:54
Subject: CHAR data type

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