date format [message #3449] |
Fri, 27 September 2002 10:23 |
saritha
Messages: 15 Registered: October 2001
|
Junior Member |
|
|
Hello all,
I have problem. When users enter date in "MM-DD-YYYY' format the form should be able to pull the records if they enter the date format as 'MM-DD-YYYY' as ORacle stores dates in "Dd-MON-YYYY' format the date is not recognized in the flowwing query.
-------------
select dept_payin_no,payin_line_no, payin_date, cr_dr_flag, payin_amount, post_flag,
gl_Fund_code, gl_org_code, gl_acct_code, gl_prog_code,payin_comment, post_date,
Posted_by
from post_treasury
where post_flag='N'
and Payin_Date=to_date(to_char(&PDATE,'MM-DD-YYYY'),'MM-DD-YYYY')
Where &Pdate is the runtime date that the users pass which is format "MM-DD-YYYY' format.
Can anyone help with this?
thanx
|
|
|
Re: date format [message #3450 is a reply to message #3449] |
Fri, 27 September 2002 10:45 |
|
Mahesh Rajendran
Messages: 10707 Registered: March 2002 Location: oracleDocoVille
|
Senior Member Account Moderator |
|
|
convert both the dates to a common date format
like this
SQL> ed
Wrote file afiedt.buf
1 select hiredate from emp
2* where to_date(hiredate,'DD-MM-YY')=TO_date('22-02-81','DD-mm-yy')
SQL> /
HIREDATE
---------
22-FEB-81
or
convert the input put accordingly to the format stored in database.
error with ur code is that defualt date format is
dd-mon-yy NOT dd-mon-yyyy
|
|
|