please help
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: please help

  1. #1
    Join Date
    Apr 2001
    Posts
    46

    Question

    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.

  2. #2
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    select to_char(sysdate+ 2/24 + 35/(24*60), 'hh:mm:ss') from dual
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

  3. #3
    Join Date
    Apr 2001
    Posts
    46
    Originally posted by jmodic
    select to_char(sysdate+ 2/24 + 35/(24*60), 'hh:mm:ss') from dual
    Thanx jmodic for giving the respose
    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]

  4. #4
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    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;
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width