DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: How to convert number to clock value?

  1. #1
    Join Date
    Dec 2001
    Location
    Tel-Aviv,Israel
    Posts
    233

    How to convert number to clock value?

    Hi folks,

    I need to convert a gap number to a clock format.
    i.e:
    SQL> select value from t_regional_settings
    2 where name ='GMT_GAP';

    VALUE
    -------------------------------------------------------
    -3

    I need to take this value and convert it to : - 03:00

    -5 ==> - 05:30
    +12 ==> + 12:00
    etc ...

    How to do it?

    Thanks in advane.
    Nir

  2. #2
    Join Date
    Nov 2004
    Location
    Mumbai, India
    Posts
    452
    If I understood you correctly then this what you may want
    Code:
    select decode(abs(value),value,'+','-')||to_char(to_date(abs(value),'HH:MI'),'HH:MI') 
    from t_regional_settings
    where name ='GMT_GAP';
    Altough I failed to understood
    if -3 => -03:00
    how come
    -5 => - 05:30 ??
    There are three kinds of lies: Lies, damned lies, and benchmarks...

    Unix is user friendly. It's just very particular about who it's friends are.

    Oracle DBA

  3. #3
    Join Date
    Dec 2001
    Location
    Tel-Aviv,Israel
    Posts
    233
    Hi simply_dba,

    ooooops!
    Sorry!
    My mistake.
    +5.5 ==> +05:30

    Thanks again.
    Nir

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