please help
How do we calculate time using sql statements
select to_char(sysdate,'hh:mm:ss') from dual ,iwill get current systime.now i want add two hours thirty five minitues to current time.what is the sql statement.
Printable View
please help
How do we calculate time using sql statements
select to_char(sysdate,'hh:mm:ss') from dual ,iwill get current systime.now i want add two hours thirty five minitues to current time.what is the sql statement.
select to_char(sysdate+ 2/24 + 35/(24*60), 'hh:mm:ss') from dual
Thanx jmodic for giving the resposeQuote:
Originally posted by jmodic
select to_char(sysdate+ 2/24 + 35/(24*60), 'hh:mm:ss') from dual
I am getting wrong results.If my systime is 05:04:03
after running the above qry i am getting the following reult
07:04:16
i have to get 07:39:16
[Edited by ravisanapala on 04-25-2001 at 07:40 AM]
You are using wrong format mask for TO_CHAR function (and I copied your wrong format mask in my response :) ). You should use 'hh24:mi:ss' instead of 'hh:mm:ss'. 'MM' is used to represent month number (01 to 12), while 'MI' is used to represent minutes (00 to 59). So the correct usage is:
select to_char(sysdate+ 2/24 + 35/(24*60), 'hh24:mi:ss') from dual;