Formating Date Data Type?

Поиск
Список
Период
Сортировка
Искать

Formating Date Data Type?

От:
"Ashish Karalkar" <ashish.karalkar@info-spectrum.com>
Дата:
Hello list,
 
I am storing date as '2007-04-15' in data base as YYYY-MM-DD
 
Now I want  to format this to 15-Apr-2007.
 
Is there any way
 
I tries to use extract function but it gives in only digit format also  this function does not except column name as input
 
 
Is there any way??
 
Thanks In advance.
 

Re: Formating Date Data Type?

От:
"Ashish Karalkar" <ashish.karalkar@info-spectrum.com>
Дата:
I am in INDIA
 
 
Tried with to_char but it does not take column name/actuall date value  as argument for date
 
 
With Regards
Ashish
----- Original Message -----
Sent: Wednesday, March 21, 2007 11:38 AM
Subject: Re: [NOVICE] Formating Date Data Type?

shouldn't  windows make that format, with the regional Settings?
where are you developing your APP.


Ashish Karalkar wrote:
Hello list,
 
I am storing date as '2007-04-15' in data base as YYYY-MM-DD
 
Now I want  to format this to 15-Apr-2007.
 
Is there any way
 
I tries to use extract function but it gives in only digit format also  this function does not except column name as input
 
 
Is there any way??
 
Thanks In advance.
 

Re: Formating Date Data Type?

От:
"Ashish Karalkar" <ashish.karalkar@info-spectrum.com>
Дата:
Thanks Michael ,
It works.
With Regards
Ashish....
----- Original Message ----- 
From: "Michael Fuhr" 
To: "Ashish Karalkar" 
Cc: "Cesar Alvarez" ; ; 
"Phillip Smith" 
Sent: Wednesday, March 21, 2007 8:10 PM
Subject: Re: [NOVICE] Formating Date Data Type?


> 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 

Re: Formating Date Data Type?

От:
Phillip Smith <phillip.smith@weatherbeeta.com.au>
Дата:
Is the column a string data type or a date data type?

Assuming it's a date type, look at the to_char() function in the documentation.

Cheers,
~p

On Tue, 2007-03-20 at 10:38 +0530, Ashish Karalkar wrote:
I am storing date as '2007-04-15' in data base as YYYY-MM-DD
 
Now I want  to format this to 15-Apr-2007.

Re: Formating Date Data Type?

От:
Michael Fuhr <mike@fuhr.org>
Дата:
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

Re: Formating Date Data Type?

От:
Cesar Alvarez <c.alvarezx66@gmail.com>
Дата:
shouldn't  windows make that format, with the regional Settings?
where are you developing your APP.


Ashish Karalkar wrote:
Hello list,
 
I am storing date as '2007-04-15' in data base as YYYY-MM-DD
 
Now I want  to format this to 15-Apr-2007.
 
Is there any way
 
I tries to use extract function but it gives in only digit format also  this function does not except column name as input
 
 
Is there any way??
 
Thanks In advance.
 

FAQ