Home » SQL & PL/SQL » SQL & PL/SQL » date
date [message #222145] Fri, 02 March 2007 00:47 Go to next message
oracle_coorgi
Messages: 185
Registered: September 2006
Location: INDIA-karnataka
Senior Member
hi
1.how can i get sysdate date format as eg
02-Dec-2007
2.'03/01/2007 04:40:48 PM' as 01-March-2007
thanxs
Re: date [message #222148 is a reply to message #222145] Fri, 02 March 2007 00:54 Go to previous messageGo to next message
friendarora
Messages: 24
Registered: February 2007
Junior Member

select trunc(to_date('03/01/2007 04:40:48 PM','dd/mm/yyyy hh:mi:ss PM')) from dual;
Re: date [message #222150 is a reply to message #222145] Fri, 02 March 2007 00:59 Go to previous messageGo to next message
karismapanda
Messages: 58
Registered: January 2007
Member
alter session set nls_date_format='dd-Mon-yyyy';
Re: date [message #222152 is a reply to message #222145] Fri, 02 March 2007 01:07 Go to previous messageGo to next message
dhananjay
Messages: 635
Registered: March 2002
Location: Mumbai
Senior Member
hi,

or use the TO_CHAR function


select to_char(sysdate,'your_desired_format') from dual



regards,
Re: date [message #222158 is a reply to message #222145] Fri, 02 March 2007 01:39 Go to previous messageGo to next message
oracle_coorgi
Messages: 185
Registered: September 2006
Location: INDIA-karnataka
Senior Member
first query is correct but the second query output is 01/03/2007 i need as 01-Mar-2007
select to_char(sysdate,'dd-Mon-yyyy') from dual
select trunc(to_date('03/01/2007 04:40:48 PM','dd/mm/yyyy hh:mi:ss PM')) from dual;
Re: date [message #222170 is a reply to message #222145] Fri, 02 March 2007 02:47 Go to previous message
friendarora
Messages: 24
Registered: February 2007
Junior Member

select to_char(to_date('03/01/2007 04:40:48 PM','dd/mm/yyyy hh:mi:ss PM'),'desired format') from dual;
Previous Topic: problem in insert statment
Next Topic: SQL Query
Goto Forum:
  


Current Time: Fri Dec 09 13:21:30 CST 2016

Total time taken to generate the page: 0.22514 seconds