Home » SQL & PL/SQL » SQL & PL/SQL » date format?
date format? [message #216842] Tue, 30 January 2007 12:11 Go to next message
lunate
Messages: 74
Registered: October 2006
Location: Pakistan
Member

hi friends.
i have a simple question.
can some one helpme .
i want to put simply >> 2006 ,2007 . and then to get the complete date in the oracle date format(dd-mm-yyy).

to_date('2007','dd-mm-yyyy');

can some on help me to correct my syntax? also guid me about the datatype of '2007' .


A sample code is always worth of million words.
thanx.

[Updated on: Tue, 30 January 2007 12:12]

Report message to a moderator

Re: date format? [message #216846 is a reply to message #216842] Tue, 30 January 2007 12:39 Go to previous messageGo to next message
BlackSwan
Messages: 25041
Registered: January 2009
Location: SoCal
Senior Member
>i want to put simply >> 2006 ,2007
put where?
With TO_DATE the string to the left of the comma must match the the mask to the right of the comma; such as TO_DATE('2007','YYYY')
Re: date format? [message #216857 is a reply to message #216842] Tue, 30 January 2007 13:12 Go to previous messageGo to next message
MarcL
Messages: 455
Registered: November 2006
Location: Connecticut, USA
Senior Member
okay let me try to read your mind ..

Something like this ?


select to_char(sysdate,'YYYY') as yr_format
     , to_char(sysdate,'dd-mm-yyyy') as full_format
from dual


Marc
Re: date format? [message #216858 is a reply to message #216842] Tue, 30 January 2007 13:27 Go to previous messageGo to next message
joy_division
Messages: 4641
Registered: February 2005
Location: East Coast USA
Senior Member
And you thought that you needed an expert to answer this question for what reason?
Re: date format? [message #216861 is a reply to message #216858] Tue, 30 January 2007 13:45 Go to previous messageGo to next message
lunate
Messages: 74
Registered: October 2006
Location: Pakistan
Member

Laughing Laughing Laughing

hehehe

i was just kidding.

so u all please don't mind it.ok

Laughing Laughing Laughing
Re: date format? [message #216894 is a reply to message #216842] Tue, 30 January 2007 15:51 Go to previous message
Bill B
Messages: 1484
Registered: December 2004
Senior Member
if you mean, supply a date and ruturn TODAYS date for that year then

select to_date(to_char(sysdate,'MMDD')||&YYYY,'MMDDYYYY') FROM DUAL;
Previous Topic: How can i insert or search for single quotes( ' )?
Next Topic: Hoe do i display a newline using pl/sql
Goto Forum:
  


Current Time: Tue Dec 06 14:13:30 CST 2016

Total time taken to generate the page: 0.12740 seconds