how to add hours to date [message #185821] |
Thu, 03 August 2006 14:58  |
dhanisetti
Messages: 7 Registered: July 2006
|
Junior Member |
|
|
Hi Experts,
I want to add one hour to date which takes input from user
I used the below query
select &UserDate + 1/24 from dual
It is working but not giving the same result as the following query gives.
select sysdate + 1/24 from dual
Please help on this.
Thanks
Dhani
|
|
|
|
|
Re: how to add hours to date [message #185834 is a reply to message #185829] |
Thu, 03 August 2006 16:22  |
 |
Littlefoot
Messages: 21826 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
And how are we supposed to know WHICH ERROR did you get? Was it, perhaps, ORA-01821?
By the way, Scott's suggestion works fine on my Oracle 10g.SQL> alter session set nls_date_format = 'dd.mm.yyyy. hh24:mi';
Session altered.
SQL> SELECT
2 SYSDATE now,
3 SYSDATE + 1/24 now_plus_1_hour,
4 TO_DATE('03.08.2006. 23:20',
5 'dd.mm.yyyy. hh24:mi') + 1/24 approx_now_plus_1_hour
6 FROM dual;
NOW NOW_PLUS_1_HOUR APPROX_NOW_PLUS_1
-------------------- ----------------- -----------------
03.08.2006. 23:21 04.08.2006. 00:21 04.08.2006. 00:20
SQL>
|
|
|