How to find the number of days between 2 date elements in the XSLT file

Hello

I need to calculate the number of days between 2 date elements (type xs: date). Can you please direct me as to how I can do the same thing.

I work in 11g and using XSLT 1.0. I tried several options but yet to get a solution for this. I think that this can be done also using XSLT 2.0, but who has not worked for me.

Can someone please help with this problem, thanks in advance!

Thank you
Anju

Hello

Have you seen this message?
Re: Get the Date difference between 2 values of date in days

You can do in the XSLT file since the dates are in ISO 8601 format.
http://www.w3.org/TR/NOTE-datetime

Here is a sample XSLT...








The XSLT above will result in * 4 * for the next entry...


2012-01-11T00:00:00.000-05:00
2012-01-15T00:00:00.000-05:00

You can test this example here...
http://xslttest.appspot.com/

I hope this helps...

See you soon,.
Vlad

It is considered good etiquette to the answerers rewards with points (as "useful" - 5 pts - or 'correct' - 10pts)
https://forums.Oracle.com/forums/Ann.jspa?annID=893

Tags: Fusion Middleware

Similar Questions

  • Dynamic calculation of the number of days between two dates in a table

    Hello

    I'm working on request where I dynamically calculate the number of days between two dates in a table.

    The calculation must be dynamic, i.e., when I recover the Start_date and End_date and move to the field following (call_duration) in the same row, the difference must be calculated dynamically in this area and make sure the field read-only.

    APEX version: 5.0

    Hi BO123,

    BO123 wrote:

    Hello

    I'm working on request where I dynamically calculate the number of days between two dates in a table.

    The calculation must be dynamic, i.e., when I recover the Start_date and End_date and move to the field following (call_duration) in the same row, the difference must be calculated dynamically in this area and make sure the field read-only.

    APEX version: 5.0

    one of the way to do this by calling ajax on change of end_date.

    See the sample code given below to fetch the resulting duration and making the field read only after calculation

    Step 1: Change your page

    under CSS-> Inline, put the code below

    .row_item_disabled {
      cursor: default;
      opacity: 0.5;
      filter: alpha(opacity=50);
      pointer-events: none;
    }
    

    Step 2: Create on demand Ajax process I say CALC_DURATION

    Please check Procces Ajax, see line 6.7 How to assign a value to the variable sent by ajax call

    Declare
      p_start_date  date;
      p_end_date    date;
      p_duration number;
    Begin
      p_start_date  := to_date(apex_application.g_x01);
      p_end_date    := to_date(apex_application.g_x02);
    
       --do your calculation and assign the output to the variable p_duration
      select p_end_date - p_start_date into p_duration
        from dual;
    
      -- return calculated duration
      sys.htp.p(p_duration);
    End;
    

    Step 3: Create the javascript function

    Change your page-> the function and the declaration of the Global Variable-> put the javascript function

    You must extract the rowid in the first place, for which you want to set the time, see line 2

    assuming f06, f07 and f08 is the id of the start date, and end date columns respectively, and duration

    See no line no 8 how set the value returned by the process of ajax at the duration column

    Replace your column to the respective column identifiers in the code below

    function f_calulate_duration(pThis) {
      var row_id  = pThis.id.substr(4);
      var start_date = $('#f06_'+row_id).val();
      apex.server.process ( "CALC_DURATION", {
      x01: start_date,x02: $(pThis).val()
    }, { success: function( pData ) {
    // set duration to duration column
    $('#f08_'+row_id).val(pData);
    // disable duration column
    $("#f08_" + row_id).attr("readonly", true).addClass('row_item_disabled'); }
    });
    }
    

    Step 4: choose the end date call the javascript function

    Go to report attributes-> edit your Date column end-> column-> Attrbiutes element attributes-> put the code below

    onchange="javascript:f_calulate_duration(this);"
    


    hope this helps you,

    Kind regards

    Jitendra

  • JavaScript anomaly on the number of days between two dates

    Use ApEx 4.0, I found an anomaly in a javascript code that calculates the number of days between two dates, the current_date and the past_date. If the past and present is the or before March 10, 2013, and the current_date lies between 10 March 2013 and November 3, 2013, the number of days will be from 1 day to less than the actual number. Between November 3, 2013 and on 4 November 2013, the increments of number by 2, then the count will be accurate from this date forward.

    Here are some examples:

    March 10, 2013 = 69 days of December 31, 2012
    March 11, 2013 = 69 days of December 31, 2012
    March 12, 2013 = 70 days of December 31, 2012

    November 3, 2013 = 306 days in December 31, 2012
    November 4, 2013 = 308 days in December 31, 2012

    11 March should be 70 and 12 March should be 71. November 3 is 307 and 4 November corrects the number of fake, which began March 11.

    Change the past_date to March 10, 2013 produces the following:

    March 10, 2013 = 0 days of March 10, 2013
    March 11, 2013 = 0 days of March 10, 2013
    March 12, 2013 = 1 days of March 10, 2013

    But change the past_date to 11 March 2013, product of the correct numbers:

    March 11, 2013 = 0 days of March 11, 2013
    March 12, 2013 = 1 days of March 11, 2013
    March 13, 2013 = 2 days of March 11, 2013

    I would certainly all help to determine the cause of this anomaly. Here's the javascript code:

    var w1 = ($v ("P48_PAST_DATE"));
    W1 = (w1.toString ());
    vmon var = (w1.substr (3.3));
    vyr var = (w1.substr (7));
    var r = (vyr.length);
    If (r == 2)
    vyr. = (parseFloat (vyr) + 2000);
    vday var = (w1.substr (0.2));
    var y = (vmon.concat ("", vday, ",", vyr));
    y = Date.parse (y);

    var w2 = ($v ("P48_CURRENT_DATE"));
    var vmon2 = (w2.substr (3.3));
    var vyr2 = (w2.substr (7));
    var vday2 = (w2.substr (0.2));
    var x = (vmon2.concat ("", vday2, ",", vyr2));
    x = Date.parse (x);

    var numdays = (x - y);
    numdays = (Math.floor(numdays / 86400000));
    $s ("P48_NUMBEROFDAYS", numdays);

    Did you google for something like "javascript number of days between two dates. I think you will find the explanation to this observation:

    This method does not work correctly if there is an advanced economies jump between the two dates.

    There are examples available to calculate the difference between two dates.

  • Calculate the number of days between two dates

    Hello

    Can someone help please change my formcalc script to calculate the number of working days between two date fields.  My script currently calculates the total number of days between two dates, including the weekends which must be excluded from the total.

    If

    (HasValue (Start_Date1) & HasValue (End_Date1)) then

    $

    = Date2Num (End_Date1, "YYYY-MM-DD" "en_IE") - Date2Num (Start_Date1, "YYYY-MM-DD" "en_IE") + 1

    on the other

    ""

    endif

    Any help will be most appreciated.

    Thank you.

    Check...

    (1) you said that you put the script on the event «days1» calculate My sample imitates the variable names used in the original message, "Start_Date1" and "End_Date1". If the names of variables for the start and end dates are different, you will need to modify the script to account for these names.

    (2) the Date2Num functions in the calculation of the "totalDays" use the date format "YYYY-MM-DD". If your date habits differ from "YYYY-MM-DD" FormCalc will complain.

    Steve

  • to calculate the number of days between 2 dates

    Hi all


    I need to calculate the number of days between 2 dates.
    Y at - it no oracle built on that basis.



    Thanks in advance
    Kind regards

    Nick

    user646786 wrote:
    Hello

    Thanks a lot its really useful, but I must make a correction, I just want weekdays rather working days

    As already said, there are many examples on the forum of the calculation of the working days or the days of the week or whatever you want between certain dates of restrictions. You will need to have a go at adapting what has already been given before and then when you get stuck, come here and your postcode, and someone will take a look for you.

  • How to find the library files that are not due to problems of indexing

    I need help to know how to find the library files that are not as a result of indexing problems?

    I use Windows 7

    Thank you

    Charlene

    Try to open the folder that the library uses directly.  For example, if it is your Documents folder, open C:\Users\Charlene\Documents

  • Dynamically calculate the number of days between two dates and amounts of split

    Hello

    I have searched for a solution for this, but had no success.
    I need to show the amounts broken down by days.

    I have a table that has an amount column and start and end dates.

    I need to write a query so that the amounts will be broken evenly based on the number of days between the start date and end date.

    For example, for this line.
    insert into my_test values (' 1, '' 3-mar-2010, ' 7 - mar - 2010 ", 1000);

    the query returns this (split $1,000 over 5 days)


    ID Date amount
    1 ' 3-mar-2010' 200,00
    1 ' 4-mar-2010' 200,00
    1 ' 5-mar-2010' 200,00
    1 ' 6-mar-2010' 200,00
    1 ' 7-mar-2010' 200,00



    create table my_test)
    ID number (10),
    start_date date,
    End_date date,
    amount number (10.2)
    );


    Select * from my_test

    insert into my_test values (' 1, '' 3-mar-2010, ' 7 - mar - 2010 ", 1000);
    insert into my_test values (2, 10-mar-2010 ", 19-mar-2010", 2000);
    insert into my_test values (3, 20-mar-2010 ',' 21-mar-2010, 5000);



    Thanks in advance.

    Hello

    One way is to join a Meter of Table , a table, or (more often) a set of results includes a line for eery number 1, 2, 3,... until the maximum number of times you need to divide a line.
    For example:

    WITH     cntr     AS
    (
         SELECT     LEVEL - 1     AS n
         FROM     (  SELECT  MAX (end_date - start_date)     AS max_day_cnt
                 FROM        my_test
              )
         CONNECT BY     LEVEL <= 1 + max_day_cnt
    )
    SELECT       t.id
    ,       t.start_date + c.n                    AS dt
    ,       t.amount / (t.end_date + 1 - t.start_date)     AS amt
    FROM       my_test      t
    JOIN       cntr            c     ON     c.n <= t.end_date - t.start_date
    ORDER BY  id
    ,            dt
    ;
    

    This assumes that all dates have the same number of hours, minutes, and seconds, as is the case in your sample data.
    If this isn't the case, then use TRUNC (start_date) and TRUNC (end_date) instead of start_date and end_date or post some sample data and results if some lines do not represent a whole number of days.

  • Does anyone know how to find the .gid files?

    try opening a software I've had for a few years & never had a problem so far - telling me that they cannot find the .gid file - appreciate any help
    Thankx

    What is the application you are trying to use and what is the full error message?

    . Generally, GID files are associated with the Windows Help files and should be created automatically when the first opening of a help file.  WinHelp is obsolete and is not available in Vista or Win 7.

    A WinHelp file has a ".hlp" suffix It can be accompanied by a table in the content file (.cnt) if option the created help developer one. When Windows opens a WinHelp file, it creates a file in the same directory .gid, containing information about the file .hlp such as the location and size of the window. If the user clicks on the 'Search' tab and allows indexing of key words, Windows creates an index with the .fts (full text search) extension file.

    There are some specialized software applications that also use this file extension (example).

  • Number of days between two Dates in the Correct month

    I am trying to write a SELECT statement that returns the number of days spent on a project.

    Here's my problem. I have a table with several columns of date (start_date, end_date, etc.) as well as several other columns. Here is an example of the table.

    PROJECT... START_DATE... END_DATE
    123 ................. 1ST JANUARY 13... 15 JANUARY 13
    456 ................. 25 JANUARY 13... FEBRUARY 5, 13
    789 ................. 30 JANUARY 13... FEBRUARY 5, 13
    999 ................. 1ST FEBRUARY 13... FEBRUARY 8, 13

    I'm counting the number of days spent on projects in each month. For example, with the above data, I would come back...

    MONTHS... PROJECT_DAYS
    Jan ............. 24
    Feb ............. 18

    I tried to use a CASE statement, but I'm having a hard time to understand. Any help would be greatly appreciated!

    Published by: 987079 on February 8, 2013 13:12

    An option would be something like

      1  with project as (
      2    select 123 project_id, date '2013-01-01' start_date, date '2013-01-15' end_date from dual union all
      3    select 456, date '2013-01-25', date '2013-02-05' from dual union all
      4    select 789, date '2013-01-30', date '2013-02-05' from dual union all
      5    select 999, date '2013-02-01', date '2013-02-08' from dual
      6  ),
      7  all_days as (
      8    select start_date + level - 1 dt
      9      from (select min(start_date) start_date,
     10                   max(end_date) end_date
     11              from project)
     12   connect by level <= end_date - start_date + 1
     13  )
     14  select trunc(dt,'MM'),
     15         count(*)
     16    from all_days ad
     17         join project p on (ad.dt between p.start_date and p.end_date)
     18   group by trunc(dt,'MM')
     19*  order by trunc(dt,'MM')
    SQL> /
    
    TRUNC(DT,'MM')        COUNT(*)
    ------------------- ----------
    2013-01-01 00:00:00         24
    2013-02-01 00:00:00         18
    

    Justin

  • How to find the largest files on my drive

    My drive becomes full, and I want to delete some of the bigger files. How can I find them without going through each folder?

    Hi llk5,

     

    You can use Details view in windows Explorer to check the size of the files in the folders. You can identify the file that more large sizes depending on the size of the column and then delete them as needed. You can refer to the link below to set the details view in Explorer windows and check -

    http://Windows.Microsoft.com/en-us/Windows-Vista/change-folder-views-and-behavior

     

    I hope this helps.

  • How to find the trace file

    Hi all

    I generated a trace to help file:

    SQL > alter system set events "1940 trace name errorstack level 3";

    Modified system.

    SQL > drop user RHUNTER1;
    Drop user RHUNTER1
    *
    ERROR on line 1:
    ORA-01940: cannot delete a user who is currently logged on

    "SQL > alter system set ' 1940 trace name errorstack off events."

    Modified system.


    It's oracle database 10 g 2. Now, I checked for file trace udump. but there are a lot of generating a minute trace files. How can I find the exact trace file.

    Please help to find it.

    Thank you

    Here is the SQL that will tell you what will be your trace file name:

    MPOWEL01> l
      1   select i.value||'_ora_'||p.spid||'.trc'
      2    from v$process p, v$session s,
      3      (select value from v$parameter where name = 'instance_name') i
      4    where p.addr = s.paddr
      5*  and s.sid = userenv('sid')
    MPOWEL01> /
    
    I.VALUE||'_ORA_'||P.SPID||'.TRC'
    --------------------------------------------------------------------------------
    XXXX_ora_3014738.trc
    

    I built my own code to do this, but the above is leave a blog link, I save to the reading of the trace that you created in your session. See
    http://dioncho.WordPress.com/2009/03/19/

    HTH - Mark D Powell.

  • How to find the iso file mapping

    Hi team,

    I need to remove an iso of the database file, but I'm not able to remove the iso because it is mapped to a VM. I don't want to go and check each machine in the ESX. Because I need to perform the same type of operations on another ESX Server. So check each machine for mapping is so difficult. So is there another way we can find iso is mapped to all the machines in ESX.

    Thank you

    Sisi.

    There are several possible methods for this archive. One of the easiest is to use RVTools (http://www.robware.net/).

    André

  • How to find the update file

    Record 3-4 xml file are there I went to read only the last modified file

    I already find the time of all files, but not to get the latest file

    myDocument var = app.activeDocument;
    var myDocName = myDocument.name;
    var myDocument.filePath = myFolder.
    var Metafilepath = file (MyFolder + "/");

    myPath = Metafilepath.getFiles ("*.xml");
    If (file (myPath.Exists))
    {
    for (var i = 0; i < myPath.length; i ++)
    {
    Time = String (myPath [i]);

    Tempt1 = Temps.lastIndexOf("/");
    Tempt2 = Temps.substring (Tempt1 + 1);
    FileName = Tempt2.split("");
    var myNewFile = new File (time)
    var myModifiedFile = myNewFile.modified
    var myConcat = FileName + "" + myModifiedFile
    var myNewFile1 = myConcat.toString ();
    myPath [i] m:System.NET.Sockets.Socket.close ();
    }

    }

    Thanks in advance

    You can save yourself some typing:

    myFiles.sort (function (a, b) {return a.modified<>

    Peter

  • where are the printer presets stored? How to find the .prst files to load into InDesign?

    I use InDesign CC 2015 to a new intall of creative cloud on a new hard drive after the old one crashed. I always have access to my files on the old HARD drive and you have copied most of my files on the new drive. When I go to print in InDesign, the program seems to know what settings of the printer, I used on files that I created, but I don't see no presets. When I go to load the application InDesign presets where I should look to load the files .prst and that's what I want to know. They are on the local drive? If yes where? They are on the cloud in my Adobe account where I have my cloud files? I will keep searching my computer, but if someone knows the answer, please help.

    Printer presets are stored in the InDesign Defaults, a part of the whole of the preferences file. You should open the ID on the old system and then click on the dialog box define where you can select them and click on save, and then on the new system, you can load the game that you just saved.

  • How to find the missing file ' accserv. MIB'

    I tried to dwnld components from a cd, I was not able to file "accserv.mib is not found. How can I find file, or I can reinstall it.

    Hi Ms. Bestes,
     
     
    Given the name of file, I am assuming you are using XP (and it will be moved here).  If this isn't the case, please post to the system recovery and the theme of the repair in the Windows Forum appropriate to your operating system.

    Go to start / all programs / accessories / command prompt.  Type sfc/scannow and enter, preferably with your installation disc in the CD drive, which should find and fix the file, if it is actually absent.

    Another option, a little more extreme, but also more likely to work, is to try a 'repair installation' using the actual installation disc.  See: http://michaelstevenstech.com/XPrepairinstall.htm.

    I hope this helps.

    Good luck!

    P. S.

    On the computer itself:

    It must usually be or can be found here: C:\Windows\System32\accserv.mib

    It can sometimes be found here if it is not there (or even if it is there): C:\Windows\ServicePackFiles\i386\accserv.mib

Maybe you are looking for