Home » SQL & PL/SQL » SQL & PL/SQL » Date Functions
Date Functions [message #244723] Wed, 13 June 2007 23:22 Go to next message
akkumar81
Messages: 144
Registered: February 2007
Location: india
Senior Member

Dear friends,

My Oracle Version 9i.I given an input in 2007/06/14.
My expecting Output in this format dd-mm-yyyy.How can i do it?
AnyBody Help me.

Regards,
Arunkumar.
Re: Date Functions [message #244727 is a reply to message #244723] Wed, 13 June 2007 23:30 Go to previous messageGo to next message
BlackSwan
Messages: 25033
Registered: January 2009
Location: SoCal
Senior Member
Please read & FOLLOW posting guidelines as enumerated in #1 STICKY post at top of this forum.
please research TO_DATE & TO_CHAR functions

[Updated on: Wed, 13 June 2007 23:31] by Moderator

Report message to a moderator

Re: Date Functions [message #244729 is a reply to message #244723] Wed, 13 June 2007 23:44 Go to previous messageGo to next message
akkumar81
Messages: 144
Registered: February 2007
Location: india
Senior Member

this is correct or not?

to_char('2007/06/14',dd-mm-yyyy)

i/p date 2007/06/14

o/p format is dd-mm-yyyy.


Anybody Help me..
Re: Date Functions [message #244730 is a reply to message #244723] Wed, 13 June 2007 23:48 Go to previous messageGo to next message
BlackSwan
Messages: 25033
Registered: January 2009
Location: SoCal
Senior Member
You need to combine both into single query.

select to_char('2007/06/14',dd-mm-yyyy) from dual
                                  *
ERROR at line 1:
ORA-00904: "YYYY": invalid identifier



Re: Date Functions [message #244732 is a reply to message #244723] Wed, 13 June 2007 23:59 Go to previous messageGo to next message
BlackSwan
Messages: 25033
Registered: January 2009
Location: SoCal
Senior Member
convert a string to a date then convert the date to a string in the desired & new format.

[Updated on: Wed, 13 June 2007 23:59] by Moderator

Report message to a moderator

Re: Date Functions [message #244736 is a reply to message #244723] Thu, 14 June 2007 00:35 Go to previous messageGo to next message
akkumar81
Messages: 144
Registered: February 2007
Location: india
Senior Member

Dear friend,

I know oracle little bit so please send me answer of my requirement.expecting Your replies..

Re: Date Functions [message #244753 is a reply to message #244736] Thu, 14 June 2007 01:04 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Ana first post:
Quote:
Please read & FOLLOW posting guidelines as enumerated in #1 STICKY post at top of this forum.
please research TO_DATE & TO_CHAR functions

All is there.

You already posted many questions.
We already pointed you to the documentation.
You know the URL.
Make a little effort, please.

Regards
Michel
Re: Date Functions [message #244757 is a reply to message #244723] Thu, 14 June 2007 01:07 Go to previous messageGo to next message
BlackSwan
Messages: 25033
Registered: January 2009
Location: SoCal
Senior Member
Thanks Michel.
You are up early & it is time for me to go to bed.
Re: Date Functions [message #244795 is a reply to message #244723] Thu, 14 June 2007 02:36 Go to previous messageGo to next message
yoonus.it@gmail.com
Messages: 109
Registered: June 2007
Location: kuwait
Senior Member
try this one to_char(date,format)

ex:select to_char(sysdate,'dd-mm-yyy') from dual
Re: Date Functions [message #244798 is a reply to message #244736] Thu, 14 June 2007 02:43 Go to previous messageGo to next message
kumarn
Messages: 13
Registered: June 2007
Location: London
Junior Member
Hi akkumar81,

This is very simple.

Your input is ' 2007/06/14' and you want output as '14-06-2007' (dd-mm-yyyy) format ?

Select to_char(to_date('2007/06/14','yyyy/mm/dd'),'dd-mm-yyyy')
from dual;


Result is '14-06-2007'.

And as Michel said, do a bit of research before posting your query even if you are new to any technology. It will surely enhance your knowledge and same your time as well.

Regards,
kumarn
Re: Date Functions [message #244831 is a reply to message #244723] Thu, 14 June 2007 04:22 Go to previous messageGo to next message
akkumar81
Messages: 144
Registered: February 2007
Location: india
Senior Member

Thanku Very Much Kumar
Re: Date Functions [message #244882 is a reply to message #244831] Thu, 14 June 2007 07:51 Go to previous message
joy_division
Messages: 4640
Registered: February 2005
Location: East Coast USA
Senior Member
Hello Mr. lazy ignorant. I see you are back.
Previous Topic: Pakage.
Next Topic: dbms_jobs
Goto Forum:
  


Current Time: Sat Dec 03 07:54:04 CST 2016

Total time taken to generate the page: 0.08725 seconds