Subtract days from given date

hi,
Is there any FM which will subtract the no of days from a given date.
I hv tried with SUBTRACT_TIME_FROM_DATE , but having some config issue. And it is not available in 3.1H version.
Some one can help me out...
Thanks,
shiva

Hi,
use the FM RP_CALC_DATE_IN_INTERVAL
and check the sample output.
Import parameters               Value             
DATE                            10/10/2004        
DAYS                            05                
MONTHS                          00                
SIGNUM                          +                 
YEARS                           00                                                                               
Export parameters               Value             
CALC_DATE                       10/15/2004  
Regards
vijay

Similar Messages

  • Trying to subtract days from a date

    Im trying to subtract days from a date.
    When i use this query:
    select sysdate-:p21_DAYS_OLD from dual;
    it displays the correct date but not in the correct format. It is displaying 12-AUG-09 instead of 08/12/2009.
    I tried this query but i get the ORA-01722: invalid number error.
    select to_char(sysdate,'MM/DD/YYYY')-(:p21_DAYS_OLD) from dual;
    Can someone help me please?
    Deanna

    Dclipse03 wrote:
    Im trying to subtract days from a date.
    When i use this query:
    select sysdate-:p21_DAYS_OLD from dual;Just set the NLS_DATE_FORMAT parameter for your session and execute the above query.
    ALTER SESSION SET NLS_DATE_FORMAT='MM/DD/YYYY'
    /

  • Subtracting Days from a Date

    Am using Acrobat Pro 9 for Windows.  I have a form where I want to subtract days from Date1 and the result is Date2.  The Date1 and Date 2 text boxes are unformatted.  I've tried reading the "date" articles and experimental with some formulas but I'm afraid I'm still Acrobat illiterate.  Any ideas?  Thanks.

    It would be best if you set up the Date1 field to be formatted as a date. That way, Acrobat uses a built-in routine to automatically validate that the entry represents a valid date. You can then use a custom Calculate script for the Date2 field that looks someting like:
    // Custom Calculate script for text field
    (function () {
        // Get Date1 field value
        var v = getField("Date1").value;
        // If field is empty, blank this field
        if (v === "") {
            event.value = v;
            return;
        // Convert the date string to a date object
        var d = util.scand("mm/dd/yyyy", v);
        // Subtract 5 days
        d.setDate(d.getDate() - 5);
        // Set this field's value
        event.value = util.printd("mm/dd/yyyy", d);
    Change the date format (mm/dd/yyyy) in the code above to match what you want to use.

  • Get the date of a particular week day from given date

    I have a given date.
    from that date i want to get the date of sunday of that week
    wat is the best possible way to do the same.
    for eg:
    if i am given 03/11/2007 which is a saturday
    i want to get 27/10/2007 which is the sunday which falls in the same week as of 03/11/2007
    can anybody please help.

    hi,
    Here I am posting code for your requirement.
    Here I am hard coding the date value.
    import java.util.*;
    public class DateTest{
         public static void main(String ar[]){
              Calendar calendar =new GregorianCalendar(2007,7,4);
              System.out.println("DAY_OF_WEEK: " + calendar.get(Calendar.DAY_OF_WEEK));
              calendar.set(2007,7,4-calendar.get(Calendar.DAY_OF_WEEK)+1);
              System.out.println("DAY_OF_MONTH: " + calendar.get(Calendar.DAY_OF_MONTH));
              System.out.println("MONTH: " + calendar.get(Calendar.MONTH));
    }

  • Number of days in given date/month

    Hi,
    Can you send query to find the number of days in given date/month
    Regards,
    Venkat.

    If you want No. of days between two date then you can just Subtract them. If you want the number of days in a month you can get the first and last day of the month and subtract them.
    Solution for a month.
    SQL> with t as (select to_date('&month','mmyyyy') as dt from dual)
      2  select (last_day(dt) - trunc(dt, 'mm'))+1
      3    from t
      4  /
    Enter value for month: 012009
    old   1: with t as (select to_date('&month','mmyyyy') as dt from dual)
    new   1: with t as (select to_date('012009','mmyyyy') as dt from dual)
    (LAST_DAY(DT)-TRUNC(DT,'MM'))+1
                                 31
    SQL> /
    Enter value for month: 022009
    old   1: with t as (select to_date('&month','mmyyyy') as dt from dual)
    new   1: with t as (select to_date('022009','mmyyyy') as dt from dual)
    (LAST_DAY(DT)-TRUNC(DT,'MM'))+1
                                 28
    SQL> /
    Enter value for month: 122009
    old   1: with t as (select to_date('&month','mmyyyy') as dt from dual)
    new   1: with t as (select to_date('122009','mmyyyy') as dt from dual)
    (LAST_DAY(DT)-TRUNC(DT,'MM'))+1
                                 31Edited by: Karthick_Arp on Feb 19, 2009 9:56 PM

  • Subract n days from a date

    Using 2004s service pack 10.  Is there a way to subtract x number of days from a date using a formula?  I saw an earlier post that said to use function module RP_Calc_Date_In_Interval but when I search for this it says it doesn't exist.  Is it called something else in 2004s?  Is the only way to accomplish this using a function module?

    If formula variable does not work and if the "no of days is a fixed number", then next alternative is to have a routine in transformation and make the subtraction.
    Ravi Thothadri

  • Extract data on report between last 30 days from current date.

    Hi Experts,
    Ealrier i had provided user promt to select the date range, now i need to schedule the report for this i have to set the date between last 30 days from current date.
    How can i add this in formaula on record selection.
    before:
    {pm_process.pm_creation_date} in {@Start Date to UTC} to {@End Date to UTC}
    I tried:
    {pm_process.pm_creation_date} in CurrentDate() - 30 to CurrentDate()
    But this is diplaying me only data of 30th date from current date.
    Please advice.

    Hi Brian,
    Thank you!
    1. I have not created any function for {pm_process.pm_creation_date} in [CurrentDate() - 30 to CurrentDate()] i am just adding this on Record Selection and its not helping.
    2. {pm_process.pm_creation_date} in Last30Days; this is throwing below error.
    please advice what to be done?

  • How to calculate number of days from a date field

    Dear BW Experts.
    I have a field 'Create Date' in the BEx query. Now we need to create a variable which should give the number of days from the date of running the query (sy-datum) to the Create Date.
    This will help the users to get records which are say, 30 days old (Sy-datum - create date = 30) or 10 days old etc.
    Could you suggest as to how to create this variable.
    Thanks,
    Sai

    Hi,
    Step 1: Create variable on "Create Date" with User entry processing type
    Step 2: Create a restricted KF for Sales & restrict it on "Create Date" to get "Sales on day"
    Step 3: Manipulate  the values of "Create Date" on which you could restrict  "Sales" again and again to get other values
    Step 4: Create one variable (ZPUTMNTH) for u201CMonth to Dateu201D with processing by u201CCustomer Exitu201D. This variable was created  on u201CDateu201D characteristics.
    Step 5 : Goto C-mod t-code and use EXIT_SAPLRRS0_001
    to calculate "month to date" user input is "Calday" Key Date
    WHEN 'ZPUTMNTH'.
    IF I_STEP = 2. "after the popup
    LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE
    WHERE VNAM = 'ZPDATE'.
    CLEAR L_S_RANGE.
    L_S_RANGE-LOW = LOC_VAR_RANGE-LOW(6). "low value, e.g.YYYYMM (200606) part of key date (20060625)
    L_S_RANGE-LOW+6(2) = '01'. u201C low value e..g. YYYYMM01 (20060601)
    L_S_RANGE-HIGH = LOC_VAR_RANGE-LOW. "high value = input
    L_S_RANGE-SIGN = 'I'.
    L_S_RANGE-OPT = 'BT'.
    APPEND L_S_RANGE TO E_T_RANGE.
    EXIT.
    ENDLOOP.
    ENDIF.
    Assign if helps.....
    Regards,
    Suman

  • Subtracting months from current date

    how to subtract months from current date in mysql

    You are in an Oracle forum, so the Oracle answer is: use add_months(sysdate,-2) to subtract two months from the current date.
    Regards,
    Rob.

  • Payment term - 90 days from document date on 15th of the month

    Helllo,
    Can anybody please tell me how to configure following payment term?
    90 days from document date on 15th of the month i.e. as follows:
    u2022     Document date = 03.01 => Due date = 15.04 (90 days completes on 03.04)
    u2022     Document date = 15.01 => Due date = 15.04 (90 days completes on 15.04)
    u2022     Document date = 27.02 => Due date = 15.06 (90 days completes on 28.05)
    u2022     Document date = 18.03 => Due date = 15.07 (90 days completes on 16.06)
    Regards,
    CHetna Pant

    Dear,
    Define no 'fixed day' and 'additional months'. Go to payment terms section and enter 90 in 'No. of days'

  • Need to subtract one day from the date appearing

    Hi, I am modifying a script in such a way that for an output type there is an invoice date appearing.  This invoice date should be back dated to 1 date less to the actually date that is appearing currently.
    For ex the date is 2007.08.30 it should appear as 2007.08.29.
    While debugging I found that it is picking up the data for the date from the structure vbdkr and the field is fkdat. From the following code in the script.
    /:   DEFINE &SALES_ORDER& := &VBDKR-VBELN_VAUF&
    /:   INVOICE DATE,, : &VBDKR-FKDAT&
    What changes do I need to make the changes in the script or in the driver program?
    Can you please suggest?
    Thanks.

    Hi..
    You can get this Functionality by Calling a FORM (subroutine) from the Script Layout itself  There is no need to change the Print program.
    Eg:
    In the layout set -> window -> text elements. Write this before displaying invoice date
    /: PERFORM F_DATE_SUB IN PROGRAM ZPRG01
    /: CHANGING &VBDKR-FKDAT&
    /: ENDPERFORM
    INVOICE DATE,, : &VBDKR-FKDAT&
    Create the report program ZPRG01: In the program ZPRG01
    FORM F_DATE_SUB TABLES INTAB STRUCTURE ITCSY
                                                  OUTTAB STRUCTURE ITCSY.
    DATA: L_DATE TYPE D.
    READ TABLE OUTTAB INDEX 1.
    L_DATE = OUTTAB-VALUE. "you need to convert here
    SUBTRACT  1 FROM L_DATE.
    OUTTAB-VALUE = L_DATE.
    MODIFY OUTTAB INDEX 1.
    ENDFORM.
    reward if Helpful.

  • Getting (+/-)n th days date from given date

    Hi all ,Please help to solve this problem.
    Given a date, I need to get date object for the (given date-1) date object ,(given date-2),(given date-3) ....
    and also
    givendate+1,given date+2 ...
    help me out to solve this problem

    Check this code out and let me know if it works for you :
    public static GregorianCalendar add(GregorianCalendar gc, int _add) {
         gc.add (Calendar.DATE,_add);
         //System.out.println(gc.toString());
         return gc;

  • Subtracting days from GregorianCalendar

    Hi there,
    How does one subtract, let's say, 7 days from a given GregorianCalendar instance. Let's say I want to set up two instances on GregorianCalendar. The first one has a known date, like so:
    int endYear = 2005;
    int endMonth = 7;
    int endDay = 6;
    GregorianCalendar endDate = new GregorianCalendar();
    endDate.set(endYear,endMonth,endDay);
    How do I set up a second instance of GregorianCalendar set to 7 days prior to the endDate instance?
    GregorianCalendar nearDate = new GregorianCalendar();
    What I want to do here is make a comparison with todays date (a third instance of GregorianCalendar that is set to todays date), to see if todays date is within the range between endDate and nearDate.
    Can someone please help?
    Alan

    Calendar today = new GregorianCalendar();
    Calendar nextWeek;
    today.setTimeInMillis(System.currentTimeMillis());
    nextWeek = new GregorianCalendar();
    nextWeek.setTimeInMillis(today.getTimeInMillis());
    nextWeek.add(Calendar.DATE, 7);
    if (otherCalendar.getTimeInMillis() >= today.getTimeInMIlis() && otherCalendar.getTimeInMillis() <= nextWeek.getTimeInMillis()) {
        // otherCalendar is between now and a week from now
    } Of course, the above tests for a 7 day stretch starting at whatever date and time it is now and ending at the same time a week from now. If you really want "any time today (Saturday), tomorrow, etc. through next Friday" then you'll need to adjust the hours, minutes, seconds, and millis to zero.

  • Can I create a field that calculates number of days from a date field?

    Hi all,
    I need a field that will calculate the number of days elapsed whatever date is entered into the date field, and update that number of days based on the calendar/computer calendar date.  Does that make sense?
    https://www.dropbox.com/s/arkmnsxjkl4r156/AFBS_FacilitySpecialCareList02.pdf
    I set up the form so that my boss can add or subtract clients from the list.  Each client needs to have its own "Days since added to the list" number. Sorta like a little aging report.
    Is this possible?
    Many thanks,
    Laura

    Wow, I'm so stumped.  I tried to copy a bit of formcalc into the exit event for my current date field to try to make this happen, but I can't get it to work.
    My  attempt at scripting is embarrassing, but here it is:
    form1.sf1.CCSub.CCGroup.#subform[0].DateField2::exit - (FormCalc, client)
    form1.sf1.CCSub.CCGroup.#subform[0].NumericField2.rawValue = Date2Num(DateField1, "MM-DD-YY") - Date2Num(DateField2, "MM-DD-YY")
    and here's the file:
    https://www.dropbox.com/s/arkmnsxjkl4r156/AFBS_FacilitySpecialCareList02.pdf
    Can anyone help me get this right?
    Sign me: One Lost Designer
    Thanks!

  • Deducting days from a date

    How do I deduct a specified no. of days from a datestring.
    I need to be able to get the date 30 days from a specific date for example :
    6/5/2003 given date
    less 30 days
    5/6/2003 is the date that i need

    import java.util.*;
    public class TodayMinus30
         public static void main(String[] args)     
              Calendar clCalendar = Calendar.getInstance();
              clCalendar.add(Calendar.DATE, -30);
              Date myDate = clCalendar.getTime();
              System.out.println(myDate.toString());
    }

Maybe you are looking for