Date difference in APEX 4

Dear APEX Expers,
I am working on a small scale application, I have two date fields for employees leave form one is start_date, and other is end_date,
first i want to make a check that is user enters end_date less then that of start_date then system should not allow him/her and pops up a message that use a larger date thn start_date,
next I have third field where i want to show a auto difference after user enters both dates.
Thanks in Advance
Kind Regards
Mazahir Abbas

Hi,
Just go to same page:
http://apex.oracle.com/pls/otn/f?p=9904351712:18:222164516075521::NO:RP::
I add another region code for source code.
Regards,
Kartik Patel
http://patelkartik.blogspot.com/
http://apex.oracle.com/pls/apex/f?p=9904351712:1

Similar Messages

  • Confusion in tracking time difference in APEX

    Hi,
    I am using the following code to track the the time difference in APEX:
    <code>
    select nvl(decode(trunc(max(end_time)-min(start_time)),0,'',null,'',trunc(max(end_time)-min(start_time))||' Days ') ||
    decode(trunc(mod((max(end_time)-min(start_time))*24,24)),0,'',null,'',trunc(mod((max(end_time)-min(start_time))*24,24))||' Hours ')||
    decode(trunc(mod((max(end_time)-min(start_time))*24*60,60)),0,'',null,'',trunc(mod((max(end_time)-min(start_time))*24*60,60))||' Minutes'),'No End Time') as time
    from xyz
    where page_num between 200 and 207
    and id = :APP_USER;
    </code>
    The above code works fine in DB 11.1 version, when I migrated the project to DB 11.2, the above code doesn't give me the exact values.
    Suppose if the actual time taken was 4 minutes, it is displayed as 2 hours 16 mins in DB 11.2 version.
    Can someone help me to fix this?

    >
    Please update your forum profile with a real handle instead of "935799".
    I am using the following code to track the the time difference in APEX:
    &lt;code&gt;It's <tt>\</tt> not <tt>&lt;code&gt;</tt>:select nvl(decode(trunc(max(end_time)-min(start_time)),0,'',null,'',trunc(max(end_time)-min(start_time))||' Days ') ||
    decode(trunc(mod((max(end_time)-min(start_time))*24,24)),0,'',null,'',trunc(mod((max(end_time)-min(start_time))*24,24))||' Hours ')||
    decode(trunc(mod((max(end_time)-min(start_time))*24*60,60)),0,'',null,'',trunc(mod((max(end_time)-min(start_time))*24*60,60))||' Minutes'),'No End Time') as time
    from xyz
    where page_num between 200 and 207
    and id = :APP_USER;
    The above code works fine in DB 11.1 version, when I migrated the project to DB 11.2, the above code doesn't give me the exact values.
    Suppose if the actual time taken was 4 minutes, it is displayed as 2 hours 16 mins in DB 11.2 version.
    I think you must be missing something. Is the data exactly the same? Are the database/host configured exactly the same (clock settings; timezones etc)?
    Create a reproducible test case of the form:with xyz as (
    select &lt;data that reproduces the problem&gt; start_time, &lt;data that reproduces the problem&gt; end_time from dual
    union all
    select &lt;data that reproduces the problem&gt; start_time, &lt;data that reproduces the problem&gt; end_time from dual
    union all
    select nvl(decode(trunc(max(end_time)-min(start_time)),0,'',null,'',trunc(max(end_time)-min(start_time))||' Days ') ||
    decode(trunc(mod((max(end_time)-min(start_time))*24,24)),0,'',null,'',trunc(mod((max(end_time)-min(start_time))*24,24))||' Hours ')||
    decode(trunc(mod((max(end_time)-min(start_time))*24*60,60)),0,'',null,'',trunc(mod((max(end_time)-min(start_time))*24*60,60))||' Minutes'),'No End Time') as time
    from xyz

  • Date Difference in OBIEE

    Hi
    I have two date columns and I want one logical column which contains difference of those two DATE columns.
    But I found that we dont have any Date difference or Date Add functions in OBIEE Answers.
    Can anyone tell me any work around for the Date ADD/DIFF functions?
    Thanks
    Radha

    Or if you want database specific date functions, use EVALUATE and then specify the database functions. Check my blog entry here http://oraclebizint.wordpress.com/2007/09/10/oracle-bi-ee-10133-support-for-native-database-functions-and-aggregates/
    Thanks,
    Venkat
    http://oraclebizint.wordpress.com

  • Create MS Word documents from data in an Apex Form/Report

    My requirement is to create editable RTF form letters from data managed by an Apex application. I do not have BI publisher available and am looking at using the XSL-FO route. Effectively I want the user to select the desired data in the Apex application, hit a button and be presented with a word document containing the data, which they can then customise.
    I know how to set Apex up to create PDFs based on reports using embedded XSL-FO but PDFs are not editable extra steps by the user. Also the user could export data to CSV and mailmerge with a word template but thats extra work for the user too.
    In the past I've used PLSQL/XML/XSL-FO with .NET to do what I want here by generating an XML file with PLSQL and using .NET to associate the XML file to XSLT/XSL-FO template files creating output as varied as .doc, .ps and .html files.
    Any ideas on acheving the same flexibility with Apex would be greatly appreciated. As my googling and forum hunting has not turned up much.
    Thanks
    FunkyMonkey

    Hi FunkyMonkey,
    Do you know Docufy | Simplify with docufy ? It's an APEX application that lets you create/generate/edit word templates. Else JasperReports Library | Free software downloads at SourceForge.net lets you generate a multitude of report formats (RTF/pdf/docx/xlsx/xml/etc.) you can use iReports to easily create xml templates for the reports, It's a lot simpler then xsl-fo.
    Regards,
    Vincent Deelen

  • Date Difference between to date formula variable

    Hi Expert,
                    I have create two formula variable one for Document Date and another one for Goods reciept date
    and through formula variable I am subtracting these two formula variable and getting the no. of days between
    document date and GR date.
    This Shows me the correct value for one document date because i am filtering my query according to document
    date,
    while i am giving the date range for document date is shows me incorrect result. bucause document date formula
    variable contains only one date.
    Eg. i am giving the document date range like 01.02.2010 - 28.02.2010.
          In document date formula variable it contains only 01.02..2010 and GR date formula variable it contain correct
    value, thats why the date difference is incorrect because those PO which has PO date like 12.02.2010 for that Doc
    formula variable bring the same date like 01.02.2010.
    Please tell me the solution
    Thanks and Regards
    Lalit Kumar

    Hi Expert,
                     Actually i have created two formula variable on for PO date and another for GR date
    and i've restrict the query through PO date.
    while i am taking the single PO date in Selection parameter it showing me correct difference
    eg: Selection Parameter for PO: 01.01.2010
    But while i am taking the date interval for PO date
    eg: 01.01.2010-30.01.2010
    PO No: XXXXX123 , Doc date: 01.01.2010 GR date: 7.01.2010 then date difference is : 6
    PO No: XXXXX432, Doc date: 03.01.2010 GR date: 8.01.2010 then date difference is : 7 but it is 5
    Thanks and Regards
    Lalit Kumar

  • Data difference between DBA_HIST_SQLSTAT and DBA_HIST_ACTIVE_SESS_HISTORY

    HI,
    I ran a query on a database few times which had different execution plan (basically first I ran with index and later without index).
    I tried to cross verify the data from DBA_HIST_SQLSTAT and DBA_HIST_ACTIVE_SESS_HISTORY for that particular query and found there were two different SQL ID for same SQL statement. Ideally if execution plan changes then only the plan hash value or hash value changes but in this scenario we have two different SQL ID with different Plan hash value or hash value.
    I need to understand why do we have this data difference?
    ==================================================================================================
    SQL> select snap_id,instance_number,sample_time,session_id,module,sql_plan_hash_value from dba_hist_active_sess_history where sql_id='9zgyc24gzsgpz';
    SNAP_ID INSTANCE_NUMBER SAMPLE_TIME SESSION_ID MODULE SQL_PLAN_HASH_VALUE
    9478 2 07-JAN-11 13.09.11.540 503 SQL*Plus 2290340548
    9478 2 07-JAN-11 13.23.42.616 514 SQL*Plus 3778028574
    9478 2 07-JAN-11 13.25.12.735 514 SQL*Plus 3778028574
    9478 2 07-JAN-11 13.25.22.746 514 SQL*Plus 3778028574
    9478 2 07-JAN-11 13.25.32.759 514 SQL*Plus 3778028574
    9478 2 07-JAN-11 13.25.42.770 514 SQL*Plus 3778028574
    9478 2 07-JAN-11 13.25.52.782 514 SQL*Plus 3778028574
    9478 2 07-JAN-11 13.26.02.795 514 SQL*Plus 3778028574
    9478 2 07-JAN-11 13.26.12.811 514 SQL*Plus 3778028574
    9478 2 07-JAN-11 13.26.22.823 514 SQL*Plus 3778028574
    SQL> select snap_id,sql_id,plan_hash_value from dba_hist_sqlstat where sql_id='9zgyc24gzsgpz' ;
    SNAP_ID SQL_ID PLAN_HASH_VALUE
    9478 9zgyc24gzsgpz 2290340548
    ==================================================================================================
    Thanks
    Devendra

    Hi,
    DBA_HIST_ACTIVE_SESS_HISTORY is a sampling of the sampling already done in ASH, however data used for AWR "snapshots" is completely separate and works just like Statspack did, so it can capture all SQL in the shared pool at the time of the snapshot if you tell it to - it is not limited to just the SQL sampled by ASH. Also AWR does not capture every statement executed in the interval,even if the statement was not aged out from V$SQL.
    DBA_HIST_ACTIVE_SESS_HISTORY displays the history of the contents of the in-memory active session history of recent system activity, DBA_HIST_SQLSTAT displays historical information about SQL statistics
    Regards,
    Ugur

  • Xcelsius doesn't display the date difference in Preview

    Hi,
    Im using the Xcelsius Enterprise 2008 and I use XML connectivity for the source. I would like to do some date difference calculation on my spread sheet. But the result of the date difference does no appear on the Preview for some reason. My XML file has got the date format dd/mm/yyyy hh:mm. I tried to convert the date to number format by multiplying the date by 1. When I do this the result appears correctly as I want on the Preview, but the problem is when there is a first refresh, the date difference shows a error value "#Value". I tried to enable XML Map Properties -> When refreshing or importing data:
    1. Overwrite existing data with new data
    2. Append new data to existing XML lists.
    But still not of any use. Could any one please give me a tip to resolve my problem.
    Many thanks in advance.
    Priya

    Hi Priya
    Can you please tell me what formula are you using to take difference in dates?
    Just to tell you as a point of information, Xcelsius is capable to handle very limited set of formulas. In spreadsheet you will see the formula working perfectly fine but right after hitting preview button you wont be able to see values calculated by certain formulas in Excel. So, its always good to use less and very basic formulas.
    Regards,
    Waqas

  • How we calculate the date difference between two list in SharePoint 2010

    Hi friend's....I have two list first is list1. In this list i have two coulmn start_date and End_date. In second list2 i have two column HolidayName and Holiday_date. Now i want two find the number of day in list1 Excluding Weekend and Holiday_date(that
    column from list2). How i will do ..? Please help me dosto..

    Thanks for reply...
    I have done the date difference in list1. But i want to Exclude the Holiday_date form list2.
    I have list1 - Start_date , End_date, Number_of_day(Exclude weekend and Holiday_date between Start_date and End_date )
    list2 - HolidayName, Holiday_date
    Now how i will calculate the Number_of_day in first list.

  • Date difference between Requsition apporval and Po approval in Oracle apps

    My requirement is that l need to get the number of date difference between requisition apporval date(requisition) and po approval date (purchase) excluding holidays how to do it ?
    Thanks in advance..

    One PO could be generated from multiple requisitions. In that case, which requisition would you like to consider?
    One requisition could be converted into multiple POs. In that case, which PO would you like to consider?
    Assuming, there is a one-to-one relationship between your POs and requisitions:
    Link a PO to the corresponding requisition by joining po_distributions_all.req_distribution_id with po_req_distributions_all.requisition_id
    Once you have found the 2 records, get the approved_date from po_headers_all and po_requisition_headers_all
    Then go to bom_calendar_dates for those dates and find the difference between seq_num. That is what you are looking for.
    Sandeep Gandhi

  • Date Difference in same column

    select to_char(CREATEDON,'DD-MM-YYYY HH24:MM:SS'),LABSTATUS,REMARKS from history_paperlesstran
    where hnum='797551D' order by to_char(CREATEDON,'DD-MM-YYYY HH24:MM:SS');
    Rownum TO_CHAR(CREATEDON,' LABSTATUS REMARKS
    1 20-10-2010 08:10:08 1 Barcode number generated and printed
    2 20-10-2010 08:10:08 1 Barcode number generated and printed
    3 20-10-2010 08:10:08 1 Barcode number generated and printed
    4 20-10-2010 08:10:08 1 Barcode number generated and printed
    5 20-10-2010 08:10:08 1 Barcode number generated and printed
    6 20-10-2010 08:10:08 1 Barcode number generated and printed
    7 20-10-2010 09:10:55 3 Recieved in department
    8 20-10-2010 09:10:58 3 Recieved in department
    9 20-10-2010 09:10:58 3 Recieved in department
    10 20-10-2010 09:10:58 3 Recieved in department
    11 20-10-2010 09:10:58 3 Recieved in department
    12 20-10-2010 10:10:38 3 Recieved in department
    13 20-10-2010 11:10:34 1 Barcode number generated and printed
    14 20-10-2010 11:10:34 1 Barcode number generated and printed
    15 20-10-2010 11:10:35 3 Recieved in department
    16 20-10-2010 12:10:08 3 Recieved in department
    17 20-10-2010 14:10:03 1 Barcode number generated and printed
    18 20-10-2010 14:10:44 3 Recieved in department
    18 rows selected.
    Dear Friends, Now i want to get the date difference on labstatus based,i.e rownum1 - rownum7, rownum2 - rownum8, and rownum17 - rownum18
    Thing is Barcode number generated and printed - Recieved in department for each & every samples.
    Advance thanks for your solution...
    Edited by: bharathit on Oct 21, 2010 2:18 AM

    You mean something like this?
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select 1 as rn, to_date('20-10-2010 08:10:08', 'DD-MM-YYYY HH24:MI:SS') as dt, 1 as labstatus, 'Barcode number generated and printed' as comments from dual union all
      2             select 2, to_date('20-10-2010 08:10:08','DD-MM-YYYY HH24:MI:SS'), 1, 'Barcode number generated and printed' from dual union all
      3             select 3, to_date('20-10-2010 08:10:08','DD-MM-YYYY HH24:MI:SS'), 1, 'Barcode number generated and printed' from dual union all
      4             select 4, to_date('20-10-2010 08:10:08','DD-MM-YYYY HH24:MI:SS'), 1, 'Barcode number generated and printed' from dual union all
      5             select 5, to_date('20-10-2010 08:10:08','DD-MM-YYYY HH24:MI:SS'), 1, 'Barcode number generated and printed' from dual union all
      6             select 6, to_date('20-10-2010 08:10:08','DD-MM-YYYY HH24:MI:SS'), 1, 'Barcode number generated and printed' from dual union all
      7             select 7, to_date('20-10-2010 09:10:55','DD-MM-YYYY HH24:MI:SS'), 3, 'Recieved in department' from dual union all
      8             select 8, to_date('20-10-2010 09:10:58','DD-MM-YYYY HH24:MI:SS'), 3, 'Recieved in department' from dual union all
      9             select 9, to_date('20-10-2010 09:10:58','DD-MM-YYYY HH24:MI:SS'), 3, 'Recieved in department' from dual union all
    10             select 10, to_date('20-10-2010 09:10:58','DD-MM-YYYY HH24:MI:SS'), 3, 'Recieved in department' from dual union all
    11             select 11, to_date('20-10-2010 09:10:58','DD-MM-YYYY HH24:MI:SS'), 3, 'Recieved in department' from dual union all
    12             select 12, to_date('20-10-2010 10:10:38','DD-MM-YYYY HH24:MI:SS'), 3, 'Recieved in department' from dual union all
    13             select 13, to_date('20-10-2010 11:10:34','DD-MM-YYYY HH24:MI:SS'), 1, 'Barcode number generated and printed' from dual union all
    14             select 14, to_date('20-10-2010 11:10:34','DD-MM-YYYY HH24:MI:SS'), 1, 'Barcode number generated and printed' from dual union all
    15             select 15, to_date('20-10-2010 11:10:35','DD-MM-YYYY HH24:MI:SS'), 3, 'Recieved in department' from dual union all
    16             select 16, to_date('20-10-2010 12:10:08','DD-MM-YYYY HH24:MI:SS'), 3, 'Recieved in department' from dual union all
    17             select 17, to_date('20-10-2010 14:10:03','DD-MM-YYYY HH24:MI:SS'), 1, 'Barcode number generated and printed' from dual union all
    18             select 18, to_date('20-10-2010 14:10:44','DD-MM-YYYY HH24:MI:SS'), 3, 'Recieved in department' from dual)
    19  --
    20  -- END OF TEST DATA
    21  --
    22     ,x as (select rn, dt, labstatus, comments, row_number() over (partition by labstatus order by rn) as labrn from t)
    23  --
    24  select y.rn as rn1, y.dt as dt1, z.rn as rn2, z.dt as dt2, round((z.dt - y.dt)*24*60) as mins_diff
    25  from x y join x z on (y.labrn = z.labrn)
    26  where y.labstatus = 1
    27* and   z.labstatus = 3
    SQL> /
           RN1 DT1                        RN2 DT2                  MINS_DIFF
             1 20/10/2010 08:10:08          7 20/10/2010 09:10:55         61
             2 20/10/2010 08:10:08          8 20/10/2010 09:10:58         61
             3 20/10/2010 08:10:08          9 20/10/2010 09:10:58         61
             4 20/10/2010 08:10:08         10 20/10/2010 09:10:58         61
             5 20/10/2010 08:10:08         11 20/10/2010 09:10:58         61
             6 20/10/2010 08:10:08         12 20/10/2010 10:10:38        121
            13 20/10/2010 11:10:34         15 20/10/2010 11:10:35          0
            14 20/10/2010 11:10:34         16 20/10/2010 12:10:08         60
            17 20/10/2010 14:10:03         18 20/10/2010 14:10:44          1
    9 rows selected.
    SQL>

  • Date difference is not showing the correct result for date interval

    Hi Expert,
                    I've created two formula variable one for PO date and another for GR date
    while i am taking the date difference of GR and PO date for single PO date selection
    it showing me correct result , but while i am taking the date interval for PO date it not
    showing the correct result.
    eg: PO date: 01.01.2010   for a particular PO and Gr date is suppose 03.01.2010, 06.01.2010
          it showing the result 2 and 5.
    But if i am taking date interval for PO date:
    eg: 01.01.2010 - 31.01.2010
    PO date: 10.01.2010 and GR date are suppose 15.01.2010, 22.01.2010 and 30.01.2010
    it showing me 14, 21 and 29
    Thanks and Regards
    Lalit Kumar

    Hi Expert,
                    Through replacement path.
    Thanks and Regards
    Lalit Kumar

  • Query report with date difference.

    Hi Expert,
    I'm using below query to monitor unreleased checks. we have a policy that the holding period for unreleased check is 5 working days.
    SELECT T2.[CardCode], T2.[CardName], T0.[TransId], T0.[DueDate], T1.[Credit], T1.[U_DisBank], T4.[Name], DateDiff(dd,T0.[DueDate],GetDate()) As 'OverDue Days' FROM OJDT T0  INNER JOIN JDT1 T1 ON T0.TransId = T1.TransId  INNER JOIN OCRD T2 ON T1.ShortName = T2.CardCode  INNER JOIN "@HOFFICE"  T4 ON T1.U_Disbank = T4.Code WHERE T1.[Credit] !=0 AND  T0.[DueDate] >=[%0] AND  T0.[DueDate] <=[%1] AND  T1.[balduedeb]+T1.[balduecred] !=0 ORDER BY T4.[Name]
    However I would like to exclude weekends in computing date difference. Can you please help me modify my query code?
    Thanks,
    Arlmi2000

    Hi,
    A simple solution will be change DateDiff(dd,T0.DueDate,GetDate()) to DateDiff(dd,T0.DueDate,GetDate())*5/7+1
    This can cover all the weekends. If you need to be exact that including public holiday, the coding will be  longer.
    Thanks,
    Gordon

  • Date differences if one of the field not presenting

    Hi All,
    I have two attributes start date and end. I have created formula replacement variable.
    some  times one of the field coming as blank, in such acase system writing some garbage value but i need blank.
    How to resolve this issue.
    Reagrds,
    J B

    Hi,
    You can create a new formula in query designer with a condition such that date difference doesn't fall in the invalid value. If it that invalid value put the result as '0'.
    http://help.sap.com/saphelp_nw04/helpdata/en/23/17f13a2f160f28e10000000a114084/frameset.htm
    If the output is showing as '0' for the invalid values then in the query properties select the Display zeroes as Do Not Display Zeroes.
    http://help.sap.com/saphelp_nw04/helpdata/en/1e/99ea3bd7896f58e10000000a11402f/frameset.htm
    Hope this helps.........
    Rgs,
    Ravikanth.

  • Finding Date difference

    Hi,
    I want to find the duration of stock in quality.
    Is there any direct formula available to calculate the date difference.
    Or I need to create a variable for this.
    Thanks, Jeetu

    Hi,
    You can also calculate date difference at query level using replacement path variables.
    Check this link:-
    http://www.sd-solutions.com/documents/SDS_BW_Replacement%20Path%20Variables.html
    regards,
    Pruthvi R

  • Date Difference Calculation in BW3.5

    Hi
    We are calculating date differences between 2 dates i.e. Delivery Date - System Date.For System date we used variable exit to derive the value.But when we create CKF on Delivery Date,we necessary have to keep date field in Drilldown(in rows).But reports needs to give Overview while including date field in rows removes the granularity.
    Is thier any other way we can handle this situation.
    Regards
    Praveen

    You have to put ur delivery date in Rows if u r doing the Formula variable with replacement path. There is no option.
    Khaja

Maybe you are looking for