I need to get date-date by number of days, hours, minutes, seconds.

I have two dates, A and b... .i need to get the B - number of days, hours, minutes, seconds.

I need differnce between two dates in days, hours, minutes, seconds.

the day was 8 hours. Sat/Sun off

It's simple if we consider our regular calendar... .but how can I get the same if a work_calander...

That is, for example, A = Fri evening 17:00
B = Monday evening 17:00

the result should be 8 hours... (Sat/Sun, judge 9-6 to the timetables of office.. .so 1 pm Friday and 7: 00 in the LUN)

such a schedule is defined.

Please give a solution

Thanks in advance
Prince

Published by: Prince on August 27, 2008 23:42

your query is not clear enough.

Tags: Database

Similar Questions

  • A group of consecutive dates to get some absences (days, hours, minutes) and incidents

    Hello

    I'm trying to calculate and history of lack of list based on the details of lack follows.

    Here is what I got: (sorry for the dotted lines between the two, I put it just to format the data)

    EMP_ID - WORK_DT - PM - REASON - PAID
    =====-----=======------===-=====-- -- ====
    123---06/01/2009---8.0---malades---PAYE
    123---07/01/2009---8.0---malades---PAYE
    123---08/01/2009---8.0---malades---PAYE
    123---09/01/2009---8.0---malades---PAYE
    123---16/01/2009---8.0---FMLA EMP - paid
    123---17/02/2009---8.0---malades---PAYE
    123---18/02/2009---8.0---malades---PAYE
    123---30/03/2009---8.0---jure - paid
    123---21/05/2009---4.0---malades---PAYE
    123---22/05/2009---4.0---malades---PAYE
    123---03/07/2009---8.0---malades---PAYE
    123---25/08/2009---8.0---FMLA EMP - paid
    123---26/08/2009---4.5---FMLA EMP - paid
    123---21/09/2009---8.0---malades---non paid
    123---22/09/2009---8.0---malades---non paid


    I need to consolidate absences consecutive full day (8 hours) and show Start_dt, End_Dt, and also to calculate the duration of the absence in days, hours, min. If there is lack of half day (single or consecutive) is not followed by 8 hours, then they should be considered as a new incident (5/21 and 5/22). If the absence of half-day is followed by the absence of all day while they should be grouped together (8/25 and 8/26).

    So for the data mentioned above the result should look like:

    EMP_ID - START_DT - END_DT - DAYS - HOURS - minutes - INCIDENT - REASON - PAID
    ===---====== ---- ====== -- === - ==== - === - ====== - ====== -- -- =======
    123 4 06/01/2009-01/09/2009 - 0---0---1 - disease - paid
    123-16/01/2009 1-16/01/2009 - 0---0---2 - FMLA EMP - paid
    123 2 17/02/2009-02/18/2009 - 0---0---3 - disease - paid
    123 03/30/2009 1-30/03/2009 - 0---0---4 - Jury service - paid
    123 21/05/2009 0 - 21/05/2009 - 4---0---5 - disease - paid
    123 22/05/2009 0 - 22/05/2009 - 4---0---6 - disease - paid
    123 03/07/2009 1-2009-03-07 - 0---0---7 - disease - paid
    123-25/08/2009 1-08/26/2009 - 4-30-8 - EMP - paid FMLA
    123 21/09/2009-22/09/2009-2-0-0-9 - disease - unpaid

    I am able to group them to gether and get start_dt, end_dt and total days, hours as well as incident to help

    Work_Dt - Row_Number() over (order of MIN (Work_Dt) and)
    Row_Number() (order MIN (Work_Dt)

    but it includes absences consecutive half-day (5/21 and 5/22) together as a single incident that should be considered as separate incidents. any idea or help in this case will be a great help.

    Thank you

    Stéphane wrote:

    I'm trying to calculate and history of lack of list based on the details of lack follows.

    As promised:

    with t as (
               select 123 EMP_ID,to_date('01/06/2009','mm/dd/yyyy') WORK_DT,8.0 HRS,'Sick' REASON,'Paid' PAID from dual union all
               select 123,to_date('01/07/2009','mm/dd/yyyy'),8.0,'Sick','Paid' from dual union all
               select 123,to_date('01/08/2009','mm/dd/yyyy'),8.0,'Sick','Paid' from dual union all
               select 123,to_date('01/09/2009','mm/dd/yyyy'),8.0,'Sick','Paid' from dual union all
               select 123,to_date('01/16/2009','mm/dd/yyyy'),8.0,'FMLA EMP','Paid' from dual union all
               select 123,to_date('02/17/2009','mm/dd/yyyy'),8.0,'Sick','Paid' from dual union all
               select 123,to_date('02/18/2009','mm/dd/yyyy'),8.0,'Sick','Paid' from dual union all
               select 123,to_date('03/30/2009','mm/dd/yyyy'),8.0,'Jury Service','Paid' from dual union all
               select 123,to_date('05/21/2009','mm/dd/yyyy'),4.0,'Sick','Paid' from dual union all
               select 123,to_date('05/22/2009','mm/dd/yyyy'),4.0,'Sick','Paid' from dual union all
               select 123,to_date('07/03/2009','mm/dd/yyyy'),8.0,'Sick','Paid' from dual union all
               select 123,to_date('08/25/2009','mm/dd/yyyy'),8.0,'FMLA EMP','Paid' from dual union all
               select 123,to_date('08/26/2009','mm/dd/yyyy'),4.5,'FMLA EMP','Paid' from dual union all
               select 123,to_date('09/21/2009','mm/dd/yyyy'),8.0,'Sick','Unpaid' from dual union all
               select 123,to_date('09/22/2009','mm/dd/yyyy'),8.0,'Sick','Unpaid' from dual
              )
    select  EMP_ID,
            MIN(WORK_DT) START_DT,
            MAX(WORK_DT) END_DT,
            TRUNC(SUM(HRS) / 8) DAYS,
            TRUNC(MOD(SUM(HRS),8)) HOURS,
            MOD(SUM(HRS),1) * 60 MINs,
            INCIDENT,
            REASON,
            PAID
      from  (
             select  EMP_ID,
                     WORK_DT,
                     HRS,
                     REASON,
                     PAID,
                     sum(start_of_incident) over(partition by EMP_ID order by WORK_DT) INCIDENT
               from  (
                      select  t.*,
                              case
                                when     lag(WORK_DT,1,WORK_DT) over(partition by EMP_ID order by WORK_DT) = WORK_DT - 1
                                     and
                                         lag(HRS,1,8) over(partition by EMP_ID order by WORK_DT) = 8
                                     and
                                         lag(REASON,1,REASON) over(partition by EMP_ID order by WORK_DT) = REASON
                                     and
                                         lag(PAID,1,PAID) over(partition by EMP_ID order by WORK_DT) = PAID
                                  then 0
                                else 1
                              end start_of_incident
                        from  t
                     )
            )
      group by EMP_ID,
               INCIDENT,
               REASON,
               PAID
      order by EMP_ID,
               INCIDENT
    /
    
        EMP_ID START_DT   END_DT           DAYS      HOURS       MINS   INCIDENT REASON       PAID
    ---------- ---------- ---------- ---------- ---------- ---------- ---------- ------------ ------
           123 01/06/2009 01/09/2009          4          0          0          1 Sick         Paid
           123 01/16/2009 01/16/2009          1          0          0          2 FMLA EMP     Paid
           123 02/17/2009 02/18/2009          2          0          0          3 Sick         Paid
           123 03/30/2009 03/30/2009          1          0          0          4 Jury Service Paid
           123 05/21/2009 05/21/2009          0          4          0          5 Sick         Paid
           123 05/22/2009 05/22/2009          0          4          0          6 Sick         Paid
           123 07/03/2009 07/03/2009          1          0          0          7 Sick         Paid
           123 08/25/2009 08/26/2009          1          4         30          8 FMLA EMP     Paid
           123 09/21/2009 09/22/2009          2          0          0          9 Sick         Unpaid
    
    9 rows selected.
    
    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".

  • Helps identify the type of SSD memory please - need to get data from dead Air

    I just had a problem with a model of Macbook Air 11 '' 2011. He's stuck in the loop start-up chime. Reset SMC and PRAM do nothing, cannot boot from the external drive or boot in target mode. I have an appointment with Apple to get it looked at. However, research I've done so far suggests be corrupted RAM, or fried logic board. Anyway, the important thing for me to do now is get the data off of it.

    Normally, I do regular backups, but it happened during a stay. 10 days to 2 weeks holiday and all the photos and video of holiday have been about it. I need to get this, regardless regardless of the fault of the laptop. I would like to get a USB for the SSD enclosure and just after the Council about what I should look for before you buy. I have used to treat drives 2.5 "for this sort of thing, but I have to get something specific for the SSD that came with my MacBook Air?

    Help is very appreciated. Literally, this / has been wonderful and I couldn't have lost memories of a more important time. Details included below Air...

    See the following: http://eshop.macsales.com/item/OWC/MAU3ENVOY11/

    Their phone number is at the top of this screen - I would recommend calling to check which is the correct case for your model.

  • I need to get data/files from my old hard drive that won't start no-how I connect it to my new computer?

    I have a new computer with Windows Vista.  My old computer does not start (lights turn on but just spinning noise that nothing appears on the monitor).  I need to get the data/files from my old hard drive.  Can I connect the old drive to my new computer to access the files?

    Connect the older hard drive to your computer and transfer the content:

    How do I add an additional hard drive
    http://www.WikiHow.com/add-an-extra-hard-drive

  • Current Date more number of days script

    Hi all

    I have a form that I'm building that has a date field (currently Setup to specify the date of today on the load).  There is a field that slects number of days until a billing cycle (currently 0 in 13 days).

    I need to set up a script that takes today's date, adds the number of days since the result of 0-13 and gives a result of a date (0-13 days from today for example).

    Any thoughts on how I could do this?  Very new to JS.

    Thanks for any help you may be able to provide.

    Ant

    Here is an example of what I used:

    var f = this.getField ("BILLINGCYCLEDATE");

    G1 var = this.getField ("DAYS");

    var g = g1.value

    var today = new Date();

    Add var = d1.valueOf ();

    Add += 1000 * 60 * 60 * 24 g,

    future var = new Date (add);

    f.Value = util.printd ("mm/dd/yyyy", future);

    You do not want to set up as a calculation in your field BILLINGCYCLEDATE.  Field DAYS, that's all that you configured as the counter 0-13.  I implemented a simple text box where you enter a number.  The field will then calculate X number of days.   I hope this helps.

  • Added two Dates and number of days

    Hello

    I design a page that will calculate a calendar start with a the end calendar date and give me the total number of DAYS between them.

    I tried many pages of formcalc and javascript but you do not find a solution. I bet it's simple and would appreciate the help.

    Thank you

    Hello

    You can use this script Date2Num (to.rawValue, "YYYY-MM-DD") - Date2Num (from.rawValue, "YYYY-MM-DD")

    Attached example.

    BR

  • Need to obtain equal records the number of days of the month.

    Dear all

    My table and its data is given:

    Table name: Transaction_Master

    Trn_Num Trn_Dte
    1January 2, 2014
    2January 3, 2014
    3February 15, 2014
    4December 29, 2013
    5December 30, 2013
    and so on

    Now, I wish that my query must return equal records the number of days for each month of Trn_Dte. Be careful, I don't have Trn_Num column in my result. Its cities here only for explanation.

    It should, for example, records 31 to January 31 to December and 28 February.

    I tried following query but it passes loop and my db session gets hang.

    With T as

    (

    Select Distinct (Trn_Dte, 'Month') To_Char Trn_Mon, To_Number (To_Char (Last_Day (Trn_Dte), 'DD')) Tot_Day

    Of Transaction_Master

    Where Trn_Dte between parameter_1 and PARAMETRE_2

    )

    Select Distinct Trn_Mon, level

    T

    Connect by level < = Tot_Day

    Order By Trn_Mon, level

    Could you give me a solution for this case?

    Another solution for your exact needs. Try this and let me know in case of any problems. Because I changed the connection by the clause double itself.

    SELECT DISTINCT TRUNC (Trn_Dte, 'MY') + (lvl - 1)

    OF Transaction_Master aa (SELECT LEVEL lvl

    OF the double

    CONNECT BY LEVEL<= 31)="">

    WHERE Trn_Dte<= to_date('15-feb-2014','dd-mon-yyyy')="" ---="" add="">

    AND TO_CHAR(Trn_Dte,'MON') = TO_CHAR (TRUNC(Trn_Dte,'MON') + (lvl-1), 'MY');

  • Need help get data with the most recent date of entry into

    Hey guys;

    I need help with fine tuning a query to get the one with the most recent implementation.

    Here's my current query:

    /**********************************************
    Select sge.seal_group_id,
    SGE.equipment_id,
    SGE.effective_date
    of seal_group_equipment EMS.
    seal_group sg
    where equipment_id = 48801
    AND EMS. SEAL_GROUP_ID = SG. SEAL_GROUP_ID
    and sge.end_date is null
    Group of sge.equipment_id, sge.seal_group_id, sge.effective_date
    After having sge.effective_date = max (sge.effective_date)

    ******************************************************/

    Which produces the following results:
    SEAL_GROUP_ID - EQUIPMENT_ID - EFFECTIVE_DATE
    25-48801 - 01/01/1993-00: 00:00
    11730-48801 - 22/08/2003 08:42:11


    What I really need, is to show only the line with the most recent date of entry into
    I hope someone can help
    Thank you

    MAX will not work because the SEAL_GROUP_ID could depart. I would say analytical:

    select seal_group_id,
    equipment_id,
    effective_date
    from (
    select sge.seal_group_id,
    sge.equipment_id,
    sge.effective_date,
    RANK() over (partition by equipment_id order by effective_date desc) r
    from seal_group_equipment sge,
    seal_group sg
    where equipment_id = 48801
    AND SGE.SEAL_GROUP_ID = SG.SEAL_GROUP_ID
    and sge.end_date is null)
    where r = 1;
    

    Keep in mind if two records have the same effective_date, they would both appear.

    Note: query above has not been tested, since there is no script provided.

  • I need to get a new serial number for my photoshop CS4.

    My laptop recently crashed and I try to install my photoshop CS4 on my new pc.  I can't activate my photoshop CS4 with serial number provided with the software.

    Thank you

    Find the serial number of your Adobe product quickly

    Error: "serial number is not valid for this product". Adobe Creative Suite

  • How to add days, hours, minutes and seconds to a date?

    Hello

    I have the following problem.
    Saw 4 integers D, H, M, and S (each of them can be negative) and a date Da, I want to add days D, H hours, M minutes and seconds of S date Da.
    For example, if
    Da= to_date('28/06/2011 14:50:35','dd/mm/yyyy HH24:mi:ss'), and D = 3, H = -2, M = 20 and S = -12, 
    This means that I want to add 3 days, -2 hours, 20 minutes and -12 seconds to the date Da, and the new date must be in the following date:
    to_date('01/07/2011 13:10:23','dd/mm/yyyy HH24:mi:ss') 
    Is it possible to write a query for this problem or should I use PL/SQL?

    Thank you.

    There is no need of PL/SQL

    SQL> alter session set nls_date_format = 'DD/MM/YYYY HH24:MI:SS';
    
    Session altered.
    
    SQL> var d number
    SQL> var h number
    SQL> var m number
    SQL> var s number
    SQL> exec :d := 3; :h := -2; :m := 20; :s := -12
    
    PL/SQL procedure successfully completed.
    
    SQL> select to_date('28/06/2011 14:50:35','dd/mm/yyyy HH24:mi:ss')
      2     + :d
      3     + (:h / 24)
      4     + (:m / 24 / 60)
      5     + (:s / 24 / 60 / 60)
      6  from dual;
    
    TO_DATE('28/06/2011
    -------------------
    01/07/2011 13:10:23
    
  • Message need to get an administrator authority, during the passage of the second hard drive.

    Original title: pass to the second hard drive

    My computer has two hard drives of 500 GB.  One is almost full.  I want to start using the other hard drive, however when I tried my computer said that I need the authority of a Director and that I don't have that power.  I am the only administrator on the computer, so I don't understand why it says that.  In addition, as the original hard disk memory becomes more complete, my computer crashes more.

    Can anyone help?

    Hi ColMarriott,

    Using a hard drive internal or external?

    You can try the second formatting hard drive after taking a backup of the data on the disk.

    If you use an external hard drive, you can try the following steps.

    a. connect the external drive.

    b. find the external hard drive in windows Explorer

    c. right-click on the drive and select format.

    You can check the following items and check:

    Install or remove a hard drive

    Create and format a hard disk partition

    Important: Make sure that you have backed up all the data before going forward with the format.

    Since the first hard disk is full and crashing, you can try to move some data and check only files not programs drive different or another location.

    Hope this information is useful.

  • Why do I get warnings about the number of days remaining in the trial period?

    I just bought and downloaded Acrobat Pro 11, but I still continues to be treated as if I had just downloaded the trial version. In other words, I get popups telling me I have so many days before the expiration of the free trial to the left. Also an update was denied, I think, because of this.

    Michael at this point, I recommend that you remove Adobe Acrobat by using the Control Panel programs and features.  Once this is done you can then run the cleanup tool http://labs.adobe.com/downloads/acrobatcleaner.htmlAcrobat.  Once you have run the delete please wash all other shortcuts on your desktop and try to reinstall Adobe Acrobat via Adobe Application Manager.

  • Can all help with VI to get data (HEX) serial number and write in the text file

    Hello I am struggling with this problem for 2 months... They get help from different I thought I solved the problem, but of no use yet I stand on zero

    Problem: I need to get data on USB high speed HEXAGON shaped (coming in hexadecimal and be stored in the text file to the hexadecimal format as each hexadecimal value online different I'll also to attach the file)

    Get us ASCII on series or VISA read but when trying to convert to hex as shown in text file making it slower to deal with code, I know that my VI will have to improve more... I'm waiting for suggestions

    Need urgent help...

    Thanks in advance

    Hi Ali Afzal,.

    I think that the attached example can work for you. If not, then try the solution with sending the data to a parallel running the loop and store it there.

    Mike

  • ODI:i need to get a RDBMS data and put it in a file with EBCDIC enc

    I need to get data from an RDBMS and put it in a file with EBCDIC encoding using ODI
    I know how to get data and put it in the file using ODI, but do not know how to EBCDIC coding the file using ODI

    Hello

    Its very simple.

    You must specify the encoding code in the JDBC URL of the server in the topology Manager data file.

    For example,.

    JDBC:SNPs:DBFile? ENCODING =

    You can get your codes coding supported by ODI from here,

    http://download.Oracle.com/docs/CD/E17476_01/JavaSE/1.4.2/docs/guide/Intl/encoding.doc.html

    Thank you
    Guru

Maybe you are looking for