Convert Number to HH24:MI:SS

Hi,
I am using oracle database version 11.2.1 and would like to convert a number in minutes to date format HH24:MI:SS
I am using the following syntax but this does not include seconds, returns format HH24:MI
select FLOOR (165.44 / 60) || ':' || TO_CHAR (MOD (165.44, 60), 'FM00')
from dual
Is it possible to add seconds HH24:MI:SS?

select
nInt,
  extract(hour from nInt) + extract(day from nInt)*24
  ||':'||
  extract(minute from nInt)
  ||':'||
  round(extract(second from nInt))
  as result
  from (
select
numtodsinterval(165.44, 'MINUTE')
) nInt
  from dual
  union all
select
numtodsinterval(165.444, 'MINUTE')
) nInt
  from dual
union all
select
numtodsinterval(1540.30, 'MINUTE')
) nInt
  from dual
NINT RESULT
+00 02:45:26.400000 "2:45:26"
+00 02:45:26.640000 "2:45:27"
+01 01:40:18.000000 "25:40:18"

Similar Messages

  • How to convert number datatype to raw datatype for use in data warehouse?

    I am picking up the work of another grad student who assembled the initial data for a data warehouse, mapped out a dimensional dw and then created then initial fact and dimension tables. I am using oracle enterprise 11gR2. The student was new to oracle and used datatypes of NUMBER (without a length - defaulting to number(38) for dimension keys. The dw has 1 fact table and about 20 dimension tables at this point.
    Before refining the dw further, I have to translate all these dimension tables and convert all columns of Number and Number(n) (where n=1-38) to raw datatype with a length. The goal is to compact the size of the dw database significantly. With only a few exceptions every number column is a dimension key or attribute.
    The entire dw db is now sitting in a datapump dmp file. this has to be imported to the db instance and then somehow converted so all occurrences of a number datatype into raw datatypes. BTW, there are other datatypes present such as varchar2 and date.
    I discovered that datapump cannot convert number to raw in an import or export, so the instance tables once loaded using impdp will be the starting point.
    I found there is a utl_raw package delivered with oracle to facilitate using the raw datatype. This has a numbertoraw function. Never used it and am unsure how to incorporate this in the table conversions. I also hope to use OWB capabilities at some point but I have never used it and only know that it has a lot of analytical capabilities. As a preliminary step I have done partial imports and determined the max length of every number column so I can alter the present schema number columns tp be an apporpriate max length for each column in each table.
    Right now I am not sure what the next step is. Any suggestions for the data conversion steps would be appreciated.

    Hi there,
    The post about "Convert Numbers" might help in your case. You might also interested in "Anydata cast" or transformations.
    Thanks,

  • Problem in converting number to character

    Hi All,
    In my report there is number field called <?LINE_TOT_AMOUNT?>. In the next line i want to display that amount in words. I tried using
    <?xdofx:to_char(LINE_TOT_AMOUNT)?>
    but the output is same as the <?LINE_TOT_AMOUNT?>. Can any one help in solving this?

    look at TO_CHAR (number)
    if LINE_TOT_AMOUNT is number then to_char(LINE_TOT_AMOUNT) in string
    it's not display that amount in words
    it's only format row
    if you wnat to convert number to words
    plz see Re: Conversion of number to word

  • Function module for converting number to exponential???

    Hi All
      please tell me Function module for converting number to exponential.
    Deepak

    try:
    REPORT Zconvertf.
    parameters p1 type p decimals 2 default '4711.99'.
    data f1 type f.
    move p1 to f1.
    write: / p1, f1.
    hope that helps
    Andreas

  • I want to convert number to hours in oracle 10 like this.

    Dear All
    Some can help me
    I want to convert below MS-SQL query in oracle 10g. please help me.
    for eg:
    Select numasdate,
    Cast(numasdate / 60 as Varchar) + ' hours ' +
    Cast(numasdate % 60 as Varchar) + ' minutes'
    as [TotalHoursAndMinutes]
    From
    #SampleTable
    Output:
    9436 157 hours 16 minutes
    537 8 hours 57 minutes
    9323 155 hours 23 minutes
    12525 208 hours 45 minutes
    Edited by: Parwez on Jan 1, 2013 5:33 AM

    I want to convert number to hours in oracle 10g like this.
    537 8 hours 57 minutes
    9436 157 hours 16 minutes
    12525 208 hours 45 minutesTry this...
    Ranit>> with xx as(
      2      SELECT 537 num from dual UNION ALL
      3       SELECT 9436 num from dual UNION ALL
      4       SELECT 12525 num from dual
      5  )
      6  select
      7       num,
      8       FLOOR(num/60)||' hrs' as "hrs",
      9       MOD(num,60)||' minutes' as "minutes",
    10       FLOOR(num/60)||' hrs  '||MOD(num,60)||' minutes' as "Hours.Mins"
    11  from xx;
           NUM hrs                                          minutes                                          Hours.Mins                                                                                                        
           537 8 hrs                                        57 minutes                                       8 hrs  57 minutes                                                                                                 
          9436 157 hrs                                      16 minutes                                       157 hrs  16 minutes                                                                                               
         12525 208 hrs                                      45 minutes                                       208 hrs  45 minutes                                                                                                Edited by: ranit B on Jan 1, 2013 6:51 PM
    --- Hey John... I just did it and saw your hint now !!!

  • Convert number of dayes per year to data

    Please i need help in Convert number of dayes to date
    I have ID's like id
    FT*09025*0000000001 date=20090125
    FT*01171*0000000002 date=20100620
    so should convert first five number after FT to date
    example *09025*
    09 map to 2009
    025 number of dayes per year map to 25 jan
    example *01171*
    01 map to 2010
    171 number of dayes per year map to 20 jun
    (jan+feb+mar+apr+may)=(31+28+31+30+31)=151
    171-151=20 for the next month
    Please need help so will added filter to informatica map with date
    Edited by: user8929623 on Jul 4, 2010 7:04 PM

    Well, I do not follow why when 09 maps into 2009, 01 maps into 2010, not into 2001. Assuming it should be 2001, use YYDDD format:
    SQL> with t as (
      2             select 'FT*09025*0000000001' id from dual union all
      3             select 'FT*01171*0000000002' from dual
      4            )
      5  select  to_date(substr(id,4,5),'yyddd') dt
      6    from  t
      7  /
    DT
    20090125
    20010620
    SQL> SY.

  • How to convert number to string in java

    hi how can i convert number to string in java
    something like
    public void Discription(Number ownerName){
    String.valueOf(ownerName);Edited by: adf009 on 2013/04/08 7:14 PM

    Yet another way of doing it is: ownerName.toString().
    If you are working in and IDE such as Netbeans or Eclipse, type a period after the object name. Wait a second or so. Eclipse/Netbeans Intellisense will show you a list of functions that object provides that you can choose from. toString() is one of them.

  • Convert number to alphabet

    hi
    i need help in converting number to alphabet
    for example 4 to D, 2 to B, etc
    thank you for helping
    best regards
    andors

    private String Number2String(int number, bool isCaps)
        Char c
    = (Char)((isCaps ? 64 : 96) + number);
        return c.ToString();
    No point in doing - 1.
    If you want 0 to be A then start at 65 for caps, 97 for lower.
    Edit:
    After some messing around, I've come up with the perfect method:
    public static string numberToAlpha(long number, bool isLower = false)
    string returnVal = "";
    char c = isLower ? 'a' : 'A';
    while (number >= 0)
    returnVal = (char)(c + number % 26) + returnVal;
    number /= 26;
    number--;
    return returnVal;

  • Convert number to letter of alphabet?

    Hi,
    Is there a LabWindows function for converting a number to an alphabet equivalent?
    I was trying something like this...
    char getLetterOfAlphabetByNum(int number){
        //test if alpha
        if(isalpha (number)==0)
            DebugPrintf ("Error converting number to letter. Non-alphabetic.");
        else{
            //take decimal and convert to ascii
            statusReturned=Fmt (&letter, "%s<%d", number);
            if(statusReturned<0)
                DebugPrintf ("Error converting number to letter!\n");
            DebugPrintf ("tempString = %s\n", letter);
        DebugPrintf ("%d --> %s\n",number,letter);
    return letter;
    Thanks!
    Solved!
    Go to Solution.

    It seems to me that you could simplify your code this way:
    //number of alphabet to letter
    char getLetterOfAlphabetByNum (int number)
        number += 64;
        //test if alpha
        if (!isalpha (number)) {              
            DebugPrintf ("Non-alphabetic.\n");
            return 0;
        return (char)number;
    I excluded the test for printable characters as is it overcome by test for alphabetic.
    Also, be warned that passing numbers from 33 to 58 returns lowercase letters.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • Convert number to simplified chinese number (daxie)

    I need to print simplified chinese number (daxie). Do SAP have standard function module or BAPI to convert number into simplified chinese number (daxie). for example:
    1001 = &#22777;&#20191;&#38646;&#22777;&#20803;
    111 = &#22777;&#20336;&#22777;&#25342;&#22777;&#20803;
    Thanks.

    Hi,
      Use FM :SPELL_AMOUNT

  • How to add date with month after convert number to month?

    How to add date with month after convert number to month?
    Month Date Result
    24 21/11/09 24*(21/11/09)
    I want to add both the column and result should be 21/11/11
    Thanks
    Nihar

    Hmm,
    Because, you are using YYYY for '09'.
    SQL> ed
    Wrote file afiedt.buf
      1* select to_char(to_date('10/01/09','DD/MM/RRRR'),'DD/MM/YYYY') from dual
    SQL> /
    TO_CHAR(TO
    10/01/2009
    SQL> ed
    Wrote file afiedt.buf
      1* select to_char(to_date('10/01/09','DD/MM/YYYY'),'DD/MM/YYYY') from dual
    SQL> /
    TO_CHAR(TO
    10/01/0009Or with Add_months
    SQL> ed
    Wrote file afiedt.buf
      1* select to_char(add_months(to_date('10/01/09','DD/MM/YYYY'),36),'DD/MM/YYYY') from dual
    SQL> /
    TO_CHAR(AD
    10/01/0012
    SQL> ed
    Wrote file afiedt.buf
      1* select to_char(add_months(to_date('10/01/09','DD/MM/RRRR'),36),'DD/MM/YYYY') from dual
    SQL> /
    TO_CHAR(AD
    10/01/2012-Arun

  • Converting number in words

    Hi,
    I want to convert number in words and get the output through a query.
    For example :if the value in row is 1311 then I want the query to return it like one thousand three hundreds and eleven.
    Any help is highly appreciated.
    Cheers

    It could be better indeed, scope is larger, but problem with 0 still exists.
    SQL> select to_char(to_date(0,'J'), 'JSP') as converted_form from dual;
    select to_char(to_date(0,'J'), 'JSP') as converted_form from dual
    ERROR at line 1:
    ORA-01854: julian date must be between 1 and 5373484
    SQL> Better to build function as showed by Tom Kyte in the link given earlier.
    Nicolas.

  • How to convert number in to Date in column formula in analyses

    Hi All,
    I have one requirement, it needs Number conversion in to date.
    I wrote like this cast(tablename.columnname as Date)
    I'm getting error [nQSError: 22025] Function Cast is called with an incompatible type. (HY000)
    column has datatype Number(10,0).
    Please any one help me.
    Thanks,
    Ashwini K

    Hi,
    Please refer below links.
    http://satyaobieesolutions.blogspot.in/2013/06/dateformat-converting-using-evaluate.html
    http://satyaobieesolutions.blogspot.in/2013/06/date-format-change.html
    Hope this help's
    Thanks,
    Satya Ranki Reddy

  • Program or FM to convert number of days into a CalDay format (ddmmyyy)

    Hi ABAP friends,
    I input calendar day values via a popup calendar from a spreadsheet to BW. So, the values that are populated in BW are the numbers, and not the date.
    For ex. when user selects a calendar day for ex. 11-April-2010, the value in excel is stored as 40279 (which is the number of days starting from 01-Jan-1900) and this is the value that gets stored in BW once we save the data.
    I'm looking for a function module or method or whatever that converts the above number (40279) into CalDay and writes it to the 0CALDAY infoobject ???
    Please help,
    Thanks,
    Venkat

    Thanks Pranaam.
    Two things:
    1. I cannot find this FM. It says FM doesn't exist. SE37 -->  HR_HK_DIFF_BT_2_DATES
    2. My requirement is actually reverse as you explained. I can certainly hard code the starting date: 01011900, but here the input should be the number of days. and I need the date (date2 in your ex.) based on the no. of days entered.
    I found another FM which does exist in my BW system. That is: FIMA_DAYS_AND_MONTHS_AND_YEARS
    Based on "From" & "To" dates, it outputs the number of days.
    But my requirement is:
    Based on the starting date (i.e. always 01011900) and number of days, it should give me the "To" date value.

  • Convert number to varchar datatype

    hi,
    I am working in oracle 9i. i am using two variables
    v_trigger_time varchar2(1000);
    v_min_run_date varchar2(1000);
    v_int_count NUMBER;
    datatype as VARCHAR2 and Number .ie ) HH:MI
    here is the query :
    select to_char(min(RUN_START_TIME),'HH24:MI')
    into v_min_run_date;
    select to_char(min(RUN_START_TIME),'DY')
    into v_run_date;
    select count(*)
    into v_int_count
    from temp_int_list
    where
    trigger_time = v_min_run_date
    in the above query ,
    trigger_time and v_min_run_date are in varchar datatype . but the v_int_count is in number datatype,
    I need the difference between v_min_run_date and trigger_time using sysdate.
    but the sysdate datatype is in date format. how to fetch the differneces between these two columns using varchar datatype in sysdate functions.
    ie ) 11:00 to 12:00 am
    rgds,.,.

    how to get the differences between these two sysdate.We can get the difference between two dates as an INTERVAL datatype:
    SQL> select ((sysdate+345/1440)-sysdate) DAY TO SECOND from dual
      2  /
    ((SYSDATE+345/1440)-SYSDATE)DAYTOSECOND
    +000000000 05:45:00
    SQL>We can get the hours and minutes using the EXTRACT function:
    SQL> with t as
      2  ( select ((sysdate+345/1440)-sysdate) DAY TO SECOND as interval from dual)
      3  select extract(HOUR from interval) as hours
      4         , extract(MINUTE from interval) as minutes
      5  from t
      6  /
         HOURS    MINUTES
             5         45
    SQL> Cheers, APC
    Blog : http://radiofreetooting.blogspot.com/

Maybe you are looking for