using to_date command to display specific month [message #348447] |
Tue, 16 September 2008 16:18  |
ukdas
Messages: 32 Registered: September 2008 Location: London
|
Member |

|
|
hi guys,
i just want to display the dates of a specific month from the table using TO_DATE command but i don't the format to use.
could anyone tell me how to write the syntax for that.
But i can do for a day of a week using TO_DATE.
thanks
With Regards
ukd
|
|
|
|
Re: using to_date command to display specific month [message #348452 is a reply to message #348447] |
Tue, 16 September 2008 16:28   |
Ronald Beck
Messages: 121 Registered: February 2003
|
Senior Member |
|
|
The "to_date" function takes a string and translates it into an Oracle DATE type, so what you're asking doesn't make sense.
If you have a table with a DATE type column and you want to display that date in a specific FORMAT, you need to use the to_char function.
For example...
select to_char(sysdate,'MM/DD/YYYY HH24:MI:SS') from dual;
select to_char(sysdate,'DD-MON-RR') from dual;
select to_char(sysdate,'fmDay, Month DD, RRRR') from dual;
Will all display the current date information in various formats. Replace "sysdate" with the information from your DATE type column in your table.
HTH,
Ron
|
|
|
|
|
|
|
Re: using to_date command to display specific month [message #348645 is a reply to message #348479] |
Wed, 17 September 2008 08:30   |
joy_division
Messages: 4963 Registered: February 2005 Location: East Coast USA
|
Senior Member |
|
|
tanmoy1048 wrote on Tue, 16 September 2008 22:43 | I think..you are searching something like this,
select to_char(column_name, 'dd-mm-yy') from table_name where to_char(column_name, 'mm')='12 ';
|
As the code is written, it will never return anything.
|
|
|
|
|
|
|
|
|
|
|
Re: using to_date command to display specific month [message #349039 is a reply to message #348447] |
Thu, 18 September 2008 12:10   |
orasuman7
Messages: 4 Registered: July 2008 Location: BANGALORE
|
Junior Member |
|
|
SQL> select to_char(sysdate,'year/mm/dd') from dual;
TO_CHAR(SYSDATE,'YEAR/MM/DD')
------------------------------------------------
two thousand eight/09/18
SQL> select to_char(sysdate,'year/month/dd') from dual;
TO_CHAR(SYSDATE,'YEAR/MONTH/DD')
-------------------------------------------------------
two thousand eight/september/18
|
|
|
|
|
|
|