Convert seconds to hours and minutes

Hello

I have a column that stores the elapsed time in seconds. I would like to convert to hours and minutes.

FOR EXAMPLE

126 seconds = 2:06. I can't find anything with a search.

Thanks in advance.

Hello
Try this code.
Salim cordially.

SELECT TO_CHAR (TRUNC (SYSDATE) + NUMTODSINTERVAL (126, 'second'),
                'hh24:mi:ss'
               ) hr
  FROM DUAL;

HR
--------
00:02:06

1 row selected.

Tags: Database

Similar Questions

  • Convert number in hours and minutes

    Hello

    I have a SQL statement that is used as a source of my report.

    One of the columns is the result of the return of a function calc_working_hours and labeled as working_hours. As seen available_time column (which is a numeric field) is converted to hours: minurtes and called by using avail_time

    To_char (FLOOR (available_time / 60)). ':' ||
    To_char (MOD (available_time, 60), "FM00") avail_time


    I need a similar display during the return of the result of the Working_Hours calc_working_hours(carer.operator_id,'CAHTL19',s.start_time). However, this function returns a varchar type as shown below (displayed as 444:00 and I need to show 07:24)

    Select
    Carer.operator_id,
    calc_working_hours (Carer.operator_id, 'CAHTL19', s.start_time) Working_Hours,
    available_time,
    To_char (FLOOR (available_time / 60)). ':' ||
    To_char (MOD (available_time, 60), "FM00") avail_time
    of s rhm_op_available_slots, rhm_operators care, rhm_operators sw, rhm_operators tl
    where s.operator_id = carer.operator_id
    and carer.bm_id = sw.operator_id
    and sw.bm_id = tl.operator_id
    and carer.operator_id = '12693'


    OPERATOR_ID | WORKING_HOURS | AVAILABLE_TIME | avail_time
    12693. 444:00 | 444. 07:24
    12693. 444:00 | 444. 07:24
    12693. 444:00 | 444. 07:24
    12693. 444:00 | 444. 07:24
    12693. 444:00 | 444. 07:24
    12693. 444:00 | 444. 07:24


    I use 11g and any help would be appreciated gratefully.

    Kind regards.

    OK, try this...

    select
    carer.operator_id,TO_CHAR ( FLOOR ((TO_NUMBER(SUBSTR(:calc_working_hours(carer.operator_id,'CAHTL19',s.start_time),1,INSTR(:calc_working_hours(carer.operator_id,'CAHTL19',s.start_time),':' ,1,1)-1))+
     TO_NUMBER(SUBSTR(:calc_working_hours(carer.operator_id,'CAHTL19',s.start_time),INSTR(:calc_working_hours(carer.operator_id,'CAHTL19',s.start_time),':' ,1,1)+1,(LENGTH(:calc_working_hours(carer.operator_id,'CAHTL19',s.start_time))+1)- (INSTR(:calc_working_hours(carer.operator_id,'CAHTL19',s.start_time),':' ,1,1)+1))/60))/ 60)) || ':' ||
     TO_CHAR ( MOD ((TO_NUMBER(SUBSTR(:calc_working_hours(carer.operator_id,'CAHTL19',s.start_time),1,INSTR(:calc_working_hours(carer.operator_id,'CAHTL19',s.start_time),':' ,1,1)-1))+
     to_number(SUBSTR(:calc_working_hours(carer.operator_id,'CAHTL19',s.start_time),INSTR(:calc_working_hours(carer.operator_id,'CAHTL19',s.start_time),':' ,1,1)+1,(LENGTH(:calc_working_hours(carer.operator_id,'CAHTL19',s.start_time))+1)- (INSTR(:calc_working_hours(carer.operator_id,'CAHTL19',s.start_time),':' ,1,1)+1))/60)), 60), 'FM00') Working_Hours,
    available_time,
    TO_CHAR ( FLOOR (available_time / 60)) || ':' ||
    TO_CHAR ( MOD (available_time, 60), 'FM00') avail_time
    from rhm_op_available_slots s, rhm_operators carer, rhm_operators sw, rhm_operators tl
    where s.operator_id = carer.operator_id
    and carer.bm_id = sw.operator_id
    and sw.bm_id = tl.operator_id
    AND CARER.OPERATOR_ID = '12693'
    

    I hope this works...

    If someone useful or appropriate, please mark accordingly.

  • DateTime picker - given to zero hours and minutes on the second click on the datepicker

    Hello

    (APEX 5.0.1 DB 11.2.0.3.0, operating system IBM AIX 7.1, time zone + 1 hour GMT Bratislava)

     

    we have the date picker in the form region with the date format JJ. MM YYYY HH24

    by clicking "Photo calendar" calendar appears with the date and the time displayed

    This means that you can see in "hours selector" currently and in 'selector of minutes', you can see current minutes

    You can change the date, the hour and minute you want

    by clicking on the button "Close" you get the date and time in the date field picker

    So far so good

    However,.

    If you click again on the calendar "Button photo calendar" appears and

    If your current time (I mean normally on a day) is at 09:59

    You will get Zero (0) hours in the hours, selector

    After you present is from 10:00 correct, you will get 10, 11, 12, 13, etc.

    It's for hours and minutes

    If your current time is 10 minutes, for example 08: 07 , 11: 09 , 12: 03 , etc

    On the second click, you'll get Zero (0) minutes

    Similar problem is in the format JJ. MM YYYY HH: mi where you get the 01 in selector hours until 10:00

    Will he please, focus on the fact that it is always on the second, third,... do not click on the first.

    Any ideas please?

    Kind regards.

    Hello

    It was recorded just as a default of 22376688.

    Thank you.

  • How to convert minutes to hours and minutes?

    Hi Sir,

    I want to convert minutes is 90 you want to convert hours and minutes this format should be

    01:30 format.

    I can't in this format?

    Thank you

    Or like this...

    SQL> select to_char(trunc(sysdate)+90/(24*60),'HH24:MI') from dual;
    
    TO_CH
    -----
    01:30
    
  • Problem converting from minutes to hours and minutes

    Hello

    I have a problem with this sql, the locations of this sql is to convert minutes to hours and minutes, for example, as you can see, I'm trying to convert 125 minutes in hours and minutes, so the result I get is 2.5 but it should be of 2.05

    If you have an idea how I could get the result to the format: 2.05 which means two hours and 5 minutes?

    It's my sql:
    Select trunc(125/60) || '.' || (125 - TRUNC(125/60)*60) result FROM dual;
    Thanks and greetings
    Carlos
    Select trunc(125/60) || '.' || lpad(mod(125,60),2,'0') result FROM dual;
    
    RESU
    ----
    2.05
    
    SQL> 
    

    SY.

  • convert a number in days, hours and minutes

    Hello

    I have a table that store minutes unpaid.

    I want to get the days, hours and minutes in separate columns

    After working hours, a day is considered to be 8 hours

    That is to say. 480 minutes is considered to be one day.

    create the table unpaidmins as

    (

    Select 480 as unpaidmins of all the double union

    Select 420 as unpaidmins of all the double union

    Select 75 as unpaidmins of all the double union

    Select 55 as double unpaidmins

    )


    Required result

    --------------------------------------------------------------------

    DAY HOURS MINUTES

    ---------------------------------------------------------------------

    1                         0                          0


    0                         7                         0


    0                         1                          15


    0                         0                           55


    -------------------------------------------------------------------



    I use oracle 10g


    Help, please






    Select

    trunc(unpaidmins/60/8) as 'DAY '.

    , trunc (mod (unpaidmins, 60 * 8) / 60) "the hours."

    , mod (mod (unpaidmins, 60 * 8), 60) as "MINUTES".

    of unpaidmins

    DAY HOURS MINUTES

    "1"    "0"    "0"

    "0"    "7"    "0"

    "0" "1" "15".

    "0" "0" "55".

  • conversion from minutes to hours and minutes

    Hi all

    I want to do two things

    1. I want to convert minutes to hours and minutes which is
    If there are 350 minutes it should be 5.50

    2. I have two times column hrs and time allowed minutes now, I want to join this two in
    in this way
    for example the hrs is 5 and time allowed mins is 40 so I should be join under 5.40


    Concerning
    Aerts.

    Hello

    The code is a little more readable now, but only a little.

    For example, I can see now that you call most GRAND where the 1st argument is a string:

        greatest(TO_CHAR ( FLOOR (((timeallowedhrs*60+timeallowedmins)-(timetakenhrs*60+timetakenmins)) / 60)) || ':'
    

    This can cause the error, if the 2nd argument is a NUMBER, but how anyone can find what is the 2nd argument to the LARGEST?
    Even though this may not cause the error ORA-01722, there is a good chance that it will give you wrong results. The string "2.00 ' is longer than the string"10 h 45', 2 'being greater than 1'. Perhaps you meant to do more BIG first, then TO_CHAR or maybe you menat another thing altogether.

    You can simplify the code you a lot if you did some calculations (such as (timeallowedhrs * 60) + timeallowedmin) only once, in a subquery.
    For example:

    INSERT INTO  prtempincent (...)
    WITH   got_a_t     AS
    (
         SELECT DISTINCT
              (timeallowedhrs * 60) + timeallowedmin     AS a
         ,     (timetakenhrs   * 60) + timetakenmin     AS t
         ,     jobcardno
         ,     shop
         ...
    )
    SELECT     jobcardno
    ,     '3'
    ,     ... FLOOR ( (a - t)
                    / 60
                ) || ':'
                  || TO_CHAR ( MOD ( (a - t)
                                           , 60
                             )
                          , 'FM00'
                          ) ...
    

    I find

    a - t
    

    easier to read and understand (and debug), that

    (timeallowedhrs*60+timeallowedmins)-(timetakenhrs*60+timetakenmins)
    

    How about you?

  • Adding the hours and minutes

    I want to add a long list of hours and minutes in numbers.

    The list will come to 1000 + hours and I want that it displays the actual number of hours and minutes, not expressed in days.

    Impossible to find a way to format the cells to allow me to th

    Did you try & see if a few suggestions here may work?

    • Create a custom cell format - Numbers Help for Mac:

    http://help.Apple.com/numbers/Mac/3.2/#/tan090042718

    The database can provide also other useful elements, if ticked off more.

    Good luck & happy computing!

  • Add the hours and minutes so far

    Hello
    I need to write a function that has two input parameters.
    Parameter1 = > Date data type, the value is in GMT.
    Parameter1 = > string value that indicates the time difference and it has the following format.

    GMT (sign) HH24Mi
    for the examples:
    GMT + 400, GMT-1400

    I need to add the offset (param2) to date (param1) and returned as output.

    I wrote a simple code but cannot make it work. I would like to know if there is another way to do it.
    create or replace
    Function         F_FUNCTION_NAME(dt date,timeZoneOffset   in   varchar2)
    return date
    As
        offset  varchar2(9);    
    Begin
        Offset := (To_Char(Substr(Substr(Timezoneoffset,4),0,Length(Substr(Timezoneoffset,4))-2)||':'||Substr(Substr(Timezoneoffset,4),-2)));
        return Dt + interval Offset hour to minute;
    End;
    Thank you.

    Hello

    Delete GMT and use the colon between the hours and minutes in this way:

    ALTER SESSION SET nls_date_format='DD-MON-YYYY HH24:MI:SS';
    
    SELECT SYSDATE
         , CAST (CAST (SYSDATE AS TIMESTAMP WITH TIME ZONE) AT TIME ZONE '+4:00' AS DATE) offset_date
      FROM DUAL;
    
    SYSDATE                OFFSET_DATE
    ---------------------- ----------------------
    06-MAR-2013 12:08:01   06-MAR-2013 15:08:01  
    

    Kind regards.
    Al

  • Display the duration in hours and Minutes

    DB version: 11.2.0.4

    We must find the time by finding the difference between END_TIME of START_TIME in the following table.

    I have a requirement in which, if the duration is more than 60 minutes, and then view it in hours: Minutes

    Results below. Is it possible that I can do this?

    create the table event_timings

    (

    event_name VARCHAR2 (3),

    date of the value of start_Time,

    end_time date

    );

    insert into event_timings values ('A', to_date (July 16, 2014 09:15 ',' dd-mm-yyyy hh24 '), to_date (July 16, 2014 09:47 ',' dd-mm-yyyy hh24 '));

    insert into event_timings values ('B', to_date (July 16, 2014 11:15 ',' dd-mm-yyyy hh24 '), to_date (July 16, 2014 12:35 ',' dd-mm-yyyy hh24 '));

    insert into event_timings values ('C', to_date (July 16, 2014 08:15 ',' dd-mm-yyyy hh24 '), to_date (July 17, 2014 11:30 ',' mm-dd-yyyy hh24 '));

    ALTER session set nls_Date_format = "dd-mm-yyyy hh24."

    SQL > select * from event_timings;

    END_TIME-START_TIME EVE

    --- ---------------- ----------------

    A 16/07/2014 09:15 16/07/2014 09:47

    B 16/07/2014 11:15 16/07/2014 12:35

    C 16/07/2014 08:15 17/07/2014 11:30

    Expected results:

    Duration of the event

    -----      --------

    A 32-minute

    B 1 hour 20 minutes

    C 27 h 15 Minutes

    Hi James,

    With the traditional way of "old":

    SELECT

    event_name,

    CASE

    WHEN h > 1

    THEN TRUNC (h) | 'Hours ' | Round ((h-trunc (h)) * 60) | "' Minutes

    ON THE OTHER

    Round (h * 60) | "' Minutes

    END

    FROM (SELECT event_name, (24 *(end_time-start_time)) event_timings h)

    ;

  • FIND THE HOURS AND MINUTES IN THE DATES

    Hello

    I REQUIRE THE OUTPUT IN HOURS, MINUTES FOR THE DIFFERENCE BETWEEN TWO DATE.

    EX:

    ((1ER DÉCEMBRE 2009 13:01) - (2 DECEMBER 2009 13:01)))

    RELEASED IN: 24.00 (24 HOURS: 00 MINUTES).

    Kind regards

    C V S

    Hello

    If DATEs are t1d and T2D, then:

    TRUNC ( (dt2 - dt1)
          * 24
          ) || TO_CHAR ( TRUNC (SYSDATE) + (dt2 - dt1)
                 , ':MI'
                 )
    

    Returns a string like 24:00 ' or '1234:56' or ' 0:12 '

  • Convert within 24 hours and computer Performance

    Dear all,

    Question 1
    I have a date/time field that contains values like this:

    CURRENT_DATE
    24-11-08 08:11
    24-11-08 01:01
    25/11/08 03:21
    25/11/08 02:21

    I want it to appear, just the date and time of 24 hours 00 minutes as:

    example of output
    24/11/08-08:00
    24-11-08 01:00
    25/11/08 03:00
    25/11/08 02:00

    How can I do this?

    Question 2
    Lets say I have a table with more than 1 million records. These million records they are divided into four categories as shown in the type of error, however, there are several categories listed in characters: like this:

    Type of Fault_Type
    Hard engine
    Soft body work
    No_Fault puncture
    Hard exhaust
    Flexible wing
    Nut No_Fault loose on wiper devices

    Would it not more efficient to perform:

    Select * from tblFault where Type = 'Engine '.

    OR

    Select * from tblFault where Type = 'Engine' and Fault_Type = 'Hard '.

    If I wanted to find all the flaws of the engine, nor are the key primary btw?

    If you want only the hour format, you can try with that.
    Along with time, if you need: 00 also, you can join by using pipe like a simple solution, if you do not want to compare the dates with all the other dates, rather than just to select the data along with the date field.

    -On time with date
    SELECT
    TO_CHAR (SYSDATE, ' DD/MM/YY HH24') FROM dual

    -Time with zero padded
    SELECT
    TO_CHAR (SYSDATE, ' DD/MM/YY HH24') |': ' |' 00' double

  • convert seconds value in hours and minutes

    Hi all

    I mean the second value entered & I want to convert to hh: mmS format... How can I proceed?

    Please guide me.

    Thank you.

    You don't say what this "input" is, but if you want to display on the front panel, all you have to do is the following:

  • How to convert hours and minutes

    Hai All

    I calculated working hours

    using update dail_att set = to_number wtime (replace (to_char (to_date('00:00','HH24:MI') +)))
    ((outtime-intime), 'HH24'),': ','.')) ;


    and now how do I convert the latter in minutes

    Thanks in advance

    Srikkanth.M
    UPDATE  dail_att
    SET     wtime = TO_NUMBER(
                        REPLACE (
                            TO_CHAR(
                                TO_DATE('00:00','HH24:MI') +(outtime - intime)
                                , 'HH24:MI')
                            ,':','.')
                    );
    

    IF the difference is outtime - intimate, why don't not you simply

    (outtime - intime) * 24 -> hours
    (outtime - intime) * 24 * 60 -> minutes
    

    Concerning
    Marcus

  • convert seconds to hours

    Hello
    How converted or get seconds timestamp or hours

    Thank you

    Like this

    SELECT EXTRACT (SECOND TO_TIMESTAMP ('15.01.2011 10:00:56 ',' DD.)) MM YYYY HH24:MI:SS')) SECOND DOUBLE.

    result is 56

Maybe you are looking for

  • Mail - some mailboxes have disappeared, where are they gone?

    In Mail - MacBook Pro, a few mailboxes have disappeared. When I search for mail I know lies in the mailboxes, the spectacle of the elements in research and on each message the name of the mailbox, they are archived shows. How can I find the boxes to

  • Can I put a keyboard on an e540 a backlit a not backlit.

    I am a student, and evenings are any type of normal. I know that I can buy the keyboard for this model but the pilots if everything works, for example hot keys fn + space and is the connector for LEDs it.

  • Satellite P500 inflicts no boot to the

    Hello Bought the Toshiba P500 this arvo, but since then the computer did pay.Now its fully charged and I have managed to turn and enter the default details (time, place, etc.), but after he finished all these stuff, it just stopped. The screen was di

  • The RAZR and Droid 4 are Global, but...

    http://www.androidcentral.com/Verizon-confirms-some-phones-will-get-updated-global-use As we have long suspected, and others have often refused, these phones will finally be capable (GSM) worldwide. The real question, when?

  • I can't initialize the disk for my new external hard drive

    I can't initialize the disk for my new external hard drive because the drop-down list in the Disk Management Console does not give me this option. I'm logged in as an administrator and running Windows XP.  The driver for the new hardware is not digit