Need to get the difference between two period

Hi All,
I need to get the difference of two posting period like period is in format YYYYMM.
I need to subtract posting perid '200512' FROM '200601' how will be it possible.
Please suggest.
Thanks,
Sandy

Hi,
YOu can also do like the following.
Determine you first day of first period and last day of second period.
data: first_day type datum,
      last_day type datum,
      days type i.
first_day = date from FM RKE_GET_FIRST_DAY_IN_PERIOD  
last_day = date from FM RKE_GET_LAST_DAY_IN_PERIOD   
days = last_day-first_day.
Thanks,
Ramakrishna

Similar Messages

  • Java code to get the difference between two dates in days

    Hi ppl,
    I need to write a user defined function to get the difference between two date nodes, in days.Please help me out
    regards,
    Prashanth

    Hi,
    have a look at those two:
    (How do I calculate the difference between two dates?)
    http://joda-time.sourceforge.net/faq.html
    Calculating the Difference Between Two Datetime Stamps
    http://www.xmission.com/~goodhill/dates/deltaDates.html
    Get difference in days
    http://javaalmanac.com/egs/java.util/CompDates.html
    Regards,
    michal

  • How to get the difference between two columns in a column group

    Hi All,
    My first time here and really new to programming. I would like to get the difference between 2 columns that are inside 
    a column group.
    Here is my sample table below: The Column Group is PeriodNumber and can only choose 2. like 1 and 2.. I would like to have a third row which will simply calculate the difference between the amounts in PeriodNumber 1 and 2.
                                PeriodNumber          
    Account                    1                            2     
    1) Cash                10,000                15,000
    2) Receivables      12,000                11,500
    3) Equipment          5,000                  5,500
    Total Assets          27,000                32,000

    Hi yabgestopa,
    From your description, you want to get the difference between two columns in a column group. After testing it in my environment, we can use custom code to achieve your requirement. For more details, you can refer to the following steps:
    Copy the custom code below and paste it to your report. (Right-click report>Report Properties>Code)
    Dim Shared Num1 As Integer
    Dim shared Num2 As Integer
    Public Function GetAmount(Amount as Integer, Type as String)
    If Type = "1" Then
    Num1=Amount
    Else
    Num2=Amount
    End If
    Return Amount
    End Function
    Public Function GetDif()
    Return Num1-Num2
    End function
    Right-click the second column to insert a third column with Outside Group-Right.
    Then use the expressions below in the matrix.
    =Code.GetAmount(Fields!Amount.Value,Fields!PeriodNumber.Value)
    =code.GetAmount(Sum(Fields!Amount.Value),Fields!PeriodNumber.Value)
    =Code.GetDif()
    The report looks like below.
    If you have any questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Need a sql query to get the difference between two timestamp in the format of hh:mm:ss.msec

    I have a database table where it keeps record of the transaction when it starts at StartTime and when it ends at EndTime. Both these entries are having the timestamp entries. Say for example, I have a tuple with Entries like 'Transaction A' starts at '2014-05-07
    20:55:03.170' and ends at '2014-05-08 08:56:03.170'. I need to find the difference between these two timestamps and my expected output is 12:01:00.000. Let me know how to achieve this ? 

    Hi,
    You can use below script which calculates difference as DD:HH:MM:SS. You can modify the same:
    DECLARE @startTime DATETIME
    DECLARE @endTime DATETIME
    SET @startTime = '2013-11-05 12:20:35'
    SET @endTime = '2013-11-10 01:22:30'
    SELECT [DD:HH:MM:SS] =
    CAST((DATEDIFF(HOUR, @startTime, @endTime) / 24) AS VARCHAR)
    + ':' +
    CAST((DATEDIFF(HOUR, @startTime, @endTime) % 24) AS VARCHAR)
    + ':' +
    CASE WHEN DATEPART(SECOND, @endTime) >= DATEPART(SECOND, @startTime)
    THEN CAST((DATEDIFF(MINUTE, @startTime, @endTime) % 60) AS VARCHAR)
    ELSE
    CAST((DATEDIFF(MINUTE, DATEADD(MINUTE, -1, @endTime), @endTime) % 60)
    AS VARCHAR)
    END
    + ':' + CAST((DATEDIFF(SECOND, @startTime, @endTime) % 60) AS VARCHAR),
    [StringFormat] =
    CAST((DATEDIFF(HOUR , @startTime, @endTime) / 24) AS VARCHAR) +
    ' Days ' +
    CAST((DATEDIFF(HOUR , @startTime, @endTime) % 24) AS VARCHAR) +
    ' Hours ' +
    CASE WHEN DATEPART(SECOND, @endTime) >= DATEPART(SECOND, @startTime)
    THEN CAST((DATEDIFF(MINUTE, @startTime, @endTime) % 60) AS VARCHAR)
    ELSE
    CAST((DATEDIFF(MINUTE, DATEADD(MINUTE, -1, @endTime), @endTime) % 60)
    AS VARCHAR)
    END +
    ' Minutes ' +
    CAST((DATEDIFF(SECOND, @startTime, @endTime) % 60) AS VARCHAR) +
    ' Seconds '
    Reference:
    http://sqlandme.com/2013/12/23/sql-server-calculating-elapsed-time-from-datetime/
    - Vishal
    SqlAndMe.com

  • To calculate the difference between two periods  in SSM

    Hi,
    I have two questions need to be clarified.
    Question 1: I have KPI named Revenue growth and the formula to calculate is  (current year revenue - previous year revenue).I am using data entry& approval.Is that technically possible to calculate the revenue difference between two periods in SSM?
    Question 2: Is that possible to enter the date as input for the variable?for example i want find the difference between two dates and the difference value is output for my variable.
    Regards
    Bala

    Hi:
    Question 1:
    We have same problem, and what we did is to create:
    - 2 NON KPI:
    R1 = Revenue current year
    R2 = Revenue previous year
    - 1 virtual KPI
    R3 = R2-R1
    Question 2:
    I don't know.
    Regards.

  • Trying to Get the "Difference" Between Two Tracks

    What I am trying to accomplish is this: I have an audio track of a voiceover with a music bed beneath it. I also have the bed music by itsself, without the voiceover. I want only the voice portion. Is there a way that I can "cancel out" the music portion or get the difference between the two tracks (just the voice portion)? It seems that there should be some means of doing this, but for the life of me I cannot figure out how to do it!
    Any advice?

    If it's exactly the same music track, then as long as you line it up sample-accurate and the levels co-incide, you can do a simple subtractive process. You need both files available, trimmed to length. Open them both in Edit View, and copy one of them to the clipboard. Open the other, and select Mix-paste, and use the 'invert' option. That will effectively subtract one from the other, with the difference being your vocal.
    Have to tell you though that the chances of getting this spot on are amazingly low... any errors at all leave you with bleed-through, about which you can do nothing.

  • How to get the difference between two HashMaps

    i have two HashMaps
    HashMap first = new HashMap<Integer,Object>();
    HashMap second = new HashMap<Integer,Object>();
    How to get the difference between one and two and put the result in the third
    HashMap third = new HashMap<Integer,Object>();

    My bad, difference of course means removeAll():Map<Integer,Object> first = new HashMap<Integer,Object>();
    Map<Integer,Object> second = new HashMap<Integer,Object>();
    Map<Integer,Object> third = new HashMap<Integer, Object>(first);
    third.keySet().removeAll(second.keySet());No loops needed.

  • Need to find the Difference between two table

    Hello ,
    I have stucked in program as below scenario:-
    I have two tables of huge data of same structure in a same schema.I need to find the difference exact values in tables.
    By using MINUS we can find the difference between two table ,i need to find the what exact difference in the there values with colunm and value at that column.
    Example TableA
    Col1 col2 col3 col4 col5.... col50
    10 ABC 2001 EE 444 TT
    40 XYZ 3002 RR 445 TT3
    80 DEF 6005 YY 446 YY8
    TableB
    Col1 col2 col3 col4 col5.... col50
    10 ABC 2001 EE 444 TT
    40 XYZ 3002 RR 445 TT3
    81 DEF 6005 Yu 447 YY8
    I need to the out put like this :-
    The Diffence between two table is
    TableA.COL1=80 TableB.Col1=81, Different
    TableA.Col4=YY TableB.col4=Yu,Different
    TableA.Col5=446TableB.col5=447,Different
    Please suggest me to write the pl/sql program for the same
    thanx in advance
    KK

    Thanx friends for all your efforts
    I have a sample code for the same,this will compare the two tables for single row in each table .
    what r the modification needed for the multiple rows of values in the two tables??
    Please suggest!!
    CREATE OR REPLACE PROCEDURE test_compare
    IS
    TYPE t_col
    IS
    TABLE OF VARCHAR2 (30)
    INDEX BY PLS_INTEGER;
    l_col t_col;
    j NUMBER := 0;
    l_sql VARCHAR2 (2000);
    col1 VARCHAR2 (30);
    col2 VARCHAR2 (30);
    val1 NUMBER;
    val2 NUMBER;
    status VARCHAR2 (30);
    CURSOR c1
    IS
    SELECT column_id, column_name
    FROM all_tab_columns
    WHERE table_name = 'TEST1';
    BEGIN
    FOR i IN c1
    LOOP
    j := j + 1;
    l_col (j) := i.column_name;
    END LOOP;
    FOR k IN 1 .. j
    LOOP
    l_sql :=
    'SELECT '
    || ''''
    || l_col (k)
    || ''''
    || ', '
    || 'TEST2.'
    || l_col (k)
    || ', '
    || ''''
    || l_col (k)
    || ''''
    || ', '
    || 'TEST1.'
    || l_col (k )
    || ', '
    || 'DECODE(TEST2.'
    || l_col (k)
    || ' -TEST1.'
    || l_col (k)
    || ', 0, ''NO CHANGE'', ''CHANGED'') FROM TEST2, TEST1';
    EXECUTE IMMEDIATE l_sql INTO col1, val1,col2, val2, status;
    IF status = 'CHANGED'
    THEN
    DBMS_OUTPUT.put_line( 'TEST2.'
    || col1
    || '='
    || val1
    || ', TEST1.'
    || col2
    || '='
    || val2
    || ', '
    || status);
    END IF;
    END LOOP;
    EXCEPTION
    WHEN OTHERS
    THEN
    DBMS_OUTPUT.put_line ('Error:- ' || SQLERRM);
    END;
    /

  • How to get the difference between two date

    Hello,
    I want to know how to write a code the tell me the difference between two date, I am using
    oracle.jbo.domain.Date
    i have a rent date and return date so my code is
    Date rent=(Date)nr.getAttrbute("RentDate"),ret=(Date)nr.getAttrbute("ReturnDate");
    is there a way to know the difference in days between those two dates ?
    Thanks

    hi,
    try this.....
    DateFormat formatter = new SimpleDateFormat("E MMM dd HH:mm:ss Z yyyy");
    Date date = (Date)formatter.parse(dateStr); //// dateStr <- from date value (that is string value)
    Date dateto = (Date)formatter.parse(datetostr); //// datetostr <- to date value (to date getting from as a string)
    Calendar cal = Calendar.getInstance();
    cal.setTime(date);
    Calendar calto = Calendar.getInstance();
    calto.setTime(dateto);
    fromDate = cal.get(Calendar.DATE) + "/" + (cal.get(Calendar.MONTH) + 1) + "/" + cal.get(Calendar.YEAR);
    toDate = calto.get(Calendar.DATE) + "/" + (calto.get(Calendar.MONTH) + 1) + "/" + calto.get(Calendar.YEAR);
    // System.out.println("from Date : " + fromDate);
    if ((fromDate != null && toDate != null) && (date.compareTo(dateto) > -1) ) {                  
    fc.addMessage("VacationQueryComponent", new FacesMessage(FacesMessage.SEVERITY_ERROR, "From Date cannot be lower than To Date", "From Date cannot be lower than To Date"));
    fc.renderResponse();
    thks.

  • Function Module to get the difference between two times.

    Hi All,
    I want to know if there is any function module that gives me the difference between two specified times.
    For Ex: Time 1: 12/01/2007 00:01 A.M
                Time 2: Time 1 - 180 Seconds. This changes the time, also may even change the Date. (As in above situation, the Time 2 will be 11/30/2007 11:58 P.M)
    Could some one please suggest if there is any function module for this case.
    Thanks in Advance.

    Hi, You can use the following function module to calculate the diffrence between to dates in the unit that you want.
    COPF_DETERMINE_DURATION calculates the difference between two dates and time in minutes and hours.
    Parameters:
    EXPORTING
         I_START_DATE "The start date of the time interval
         I_START_TIME "The start time of the time interval
         I_END_DATE   "The end date of the time interval
         I_END_TIME   "The end time of the time interval
         I_UNIT_OF_DURATION "Time unit of the duration if not to be calculated in days.
         Value     =====     Meaning
         ' '     =====     Day (default)
         D     =====     Days
         H     =====     Hours
         MIN     =====     Minutes
         MON     =====     Months
         S     =====     Seconds
         WK     =====     Weeks
         YR     =====     Years
         I_FACTORY_CALENDER     "A factory calender if not using the Gregorian calender
    IMPORTING
         E_DURATION      "Time difference in unit specified.
    Message was edited by:
            Rajesh Soman

  • How to get the difference between two BufferedImages?

    All the BufferedImage which is grabbed from AWT may be same each other,
    i only want to get the different part of two continuous BufferedImages and send ti over internet.
    I have compared two BufferedImages by RGB (int[]), but this process wastes 400~500ms,it's terrible,:)
    who has any good idea about this?
    thanks
    Best Wishes
    mauvespan

    thanks ! cary ,
    I have a list contained some BufferedImages gotten from AWT component,and then these images
    will be transfered to client and displayed in Internet explore ,actually there are only some difference
    between two continuous BufferedImages,i don't want to transfer the WHOLE image to client,SO i
    want to handler every image before sending to client , at last, the different part will only be sent to client.
    All these ideas will be contained this method:
    * Compare the specified two BufferedImages and return the different part between them.
    * @param ref the specified first image
    * @param gen the specified sencond image
    * @return the different part between the specified two images.
    public static void BufferedImage compareBufferedImage(BufferedImage ref,BufferedImage gen){
    to finish this method ,do you have any good ideas?or sample code?
    thanks
    Best wishes
    mauvespan

  • Get the difference between two java.sql.Time values

    Hi, I'm developping a web application in which I need to to subtract one java.sql,Time value from another. The two values are stored in a database field of type DateTime. I used following code
    java.sql.Time start_time=resultset.getTime("startTime");
    java.sql.Time end_time=resultset.getTime("startTime");
    java.sql.Time diff=start_time-end_time;
    can u give me any comment on this code

    Remember what the Date/Time object in Java represents - a single point in time.
    Subtracting one from another gives you an amount of time elapsed between the two dates. Fine.
    Making a new Date out of that number is incorrect. The number no longer represents a point in time, but rather a duration.
    Its like saying "There is 10 seconds difference between the two times, so the time is now 1 Jan 1970, 00:00:10 GMT".
    The simple and stupid calculation is to take the milliseconds difference, and divide it to get to a more humanly readable value.
    // duration in milliseconds
    long duration = ?????
    long durationInSeconds = duration / 1000;
    long durationInMinutes = duration / (60 * 1000);
    long durationInHours = duration / (60 * 60 * 1000);
    // careful - not always true!
    long durationInDays = duration / (24 * 60 * 60 * 1000);
    NOTE: The "daysBetween" calculation is potentially complicated by Daylight Time adjustments. The simple approach does not necessarily work exactly.
    Cheers,
    evnafets

  • How to get the difference between two dates???

    HI I have two dates and I want to test if there is an hour between them.
    Is there a way to compare two dates like mySQL can with dateDiff(date1,date2);
    Thanks alot.
    Graham

    This link is now out of date as they have revamped the structure. Yep. Here it is again: http://forum.java.sun.com/thread.jsp?forum=31&thread=502686
    I've also noticed that my comment regarding daylight saving was misleading. The demonstrated method for calculating difference between Dates is reliable. However, one needs to be careful when interpreting Dates in a daylight saving timezone.

  • How to get the difference between these two dates

    Hello Friends,
    I need to get the difference between these two fields which store dates but with varchar2 data types
    SELECT pac.segment1, pac.segment2 emp_no, pac.segment3 NAME,
    pac.segment4 POSITION, pac.segment5 start_date, pac.segment6,
    pac.segment7
    FROM per_analysis_criteria pac, fnd_id_flex_structures_vl ffs
    WHERE ffs.id_flex_structure_code = 'Employee Rejoin'
    AND ffs.id_flex_num = pac.id_flex_num
    AND TO_CHAR (TO_DATE (pac.segment7, 'YYYY/MM/DD HH24:MI:SS'))
    - TO_CHAR (TO_DATE (pac.segment6, 'YYYY/MM/DD HH24:MI:SS')) > 1;
    my query is something like this...
    am trying to find the difference between the last two columns but with not much luck..
    can some one suggest me a solution please

    SELECT pac.segment1, pac.segment2 person_id, pac.segment3 NAME,
    papf.employee_number, paaf.supervisor_id, pac.segment4 POSITION,
    pac.segment5 start_date, pac.segment6, pac.segment7,
    papf2.email_address,
    ( TO_DATE (TO_CHAR (pac.segment7), 'DD-MON-YYYY HH:MI:SS AM')
    - TO_DATE (pac.segment6, 'DD-MON-YYYY HH:MI:SS AM')
    + 1
    ) difference,
    POST.email_address
    FROM per_analysis_criteria pac,
    apps.fnd_id_flex_structures_vl ffs,
    per_all_people_f papf,
    per_all_assignments_f paaf,
    per_all_people_f papf2,
    (SELECT email_address, person_id
    FROM per_all_people_f
    WHERE person_id IN (
    SELECT person_id
    FROM per_all_assignments_f
    WHERE position_id IN (SELECT position_id
    FROM per_positions
    WHERE NAME LIKE 'HR Manager.704.')
    AND TRUNC (SYSDATE) BETWEEN effective_start_date
    AND effective_end_date)
    AND TRUNC (SYSDATE) BETWEEN effective_start_date AND effective_end_date
    AND business_group_id = fnd_profile.VALUE ('PER_BUSINESS_GROUP_ID')) POST
    WHERE ffs.id_flex_structure_code = 'Employee Rejoin'
    AND TO_CHAR (papf.person_id) = pac.segment2
    AND ffs.id_flex_num = pac.id_flex_num
    AND TRUNC (SYSDATE) BETWEEN papf.effective_start_date
    AND papf.effective_end_date
    AND papf.current_employee_flag = 'Y'
    AND papf.person_id = paaf.person_id
    AND TRUNC (SYSDATE) BETWEEN paaf.effective_start_date
    AND paaf.effective_end_date
    AND papf.person_id = paaf.person_id
    AND papf2.person_id = paaf.supervisor_id
    AND paaf.primary_flag = 'Y'
    AND TRUNC (SYSDATE) BETWEEN papf2.effective_start_date
    AND papf2.effective_end_date
    AND papf2.current_employee_flag = 'Y'
    and ( TO_DATE(to_char(pac.segment7), 'DD-MON-YYYY HH:MI:SS AM')-TO_DATE (pac.segment6, 'DD-MON-YYYY HH:MI:SS AM')+1) >1
    last line is giving me the error pls suggest a solution

  • Difference between two periods

    Hi All,
    We have two periods ZPERFROM and ZPERTO in the transactional Infocube. While writing FOX, want to calculate the difference between these periods.
    I have written the following code in FOX:
    DATA diff TYPE I.
    diff = ZPERTO - ZPERFROM.
    But it is throwing the error as:
    Formula error: Formula element ZPERTO could not be recognized
    Could you pls guide in getting the difference between the two periods.

    Hi Mayank,
    Here comes the scenario where I need to find out the difference between two periods.
    Ex: We have below records in Infocube.
    WBS     ZPERFROM     ZPERTO     0AMOUNT     0CURRENCY   0FISCPER
    W1        009.2007          012.2007    4000             USD
    W2        001.2008          003.2008    6000             EUR
    Need to distribute the amount equally for all the periods which lie between ZPERFROM and ZPERTO for each WBS. After distribution for the above records, we need to get the result as shown below:
    WBS     ZPERFROM     ZPERTO     0AMOUNT     0CURRENCY   0FISCPER
    W1        009.2007          012.2007    1000             USD                 009.2007
    W1        009.2007          012.2007    1000             USD                 010.2007
    W1        009.2007          012.2007    1000             USD                 011.2007
    W1        009.2007          012.2007    1000             USD                 012.2007
    W2        001.2008          003.2008    2000             EUR                 001.2008
    W2        001.2008          003.2008    2000             EUR                 002.2008
    W2        001.2008          003.2008    2000             EUR                 003.2008
    Could you pls guide in achieving the above result.
    Regards,
    Durga
    Message was edited by:
            Durga BW

Maybe you are looking for

  • Printing pdf's in order they were created inside Access mdb

    Apologies if this is not the correct forum. I create a number of pdf's from Access reports.  It's not uncommon to create 100+ pdfs at a time.  When the pdfs are printed, they sometimes print out of order and they need to be printed in the order they

  • How do i get ipad 2 & iphone 4 to back up in itunes 10.5, having lots of problems

    i cannot get my ipad 2 & iphone 4 to back up in itunes 10.5. It runs for hours without bakcing anything up, so cannot update to ios5 on either device.

  • R/3 extraction.{direct delta and queued delta and V3}

    Hi, I am new to BW.Can anyone explain me about R/3 extraction in detail and steps to extract from R/3 to BW. I understood direct delta.But i couldn't understand queued delta.Can anyone please explain queued delta and also V3.Are queued delta and V3 s

  • N8 + Ovi/Social + Facebook photo upload

    Does the Social/Ovi app compress the picture before sending it to Facebook? The quality doesn't seem very good once the photo has been uploaded to FB. Edit: Tested out by sending the same photo by e-mail. It seems like the Social/Ovi application comp

  • Dr. Brown's Image Processor Pro

    I've been using Dr. Brown's Image Processor Pro for years now and have never had a problem until now. I just attempted to run the Image Processor pro script and received a "failed creating default FileType tab". Anyone run across this error? I've tri