Add 365 or 366 days to selected date

Hi All.
I have form with two date field. The field EffectDate used  to enter random date and second is ExpDate to get date on one year late. How to get correct date on ExpDate field if differeence between dates possible 365 or 366 days. I will appreciate for brief explaination with sample.
Thanks.

Hi Paul,
I modified code TextField1.rawValue = TextField1.rawValue + 365
to TextField1.rawValue = TextField1.rawValue + 365 * 24 * 60 * 60
I enter in EffectDate 08/30/2010 and get in ExpDate field wrong date like 4/19/8353. How to fix it? How to make ExpDate field empty if EffecDate is empty?
Thanks.

Similar Messages

  • How i will increment  one day with Selected date

    hi,
    I have written a code, in this code i have selected a date from calendar. Now i want to know how will increment one day with this selected date. IS there anyone who can help me? please help me.
    With regards
    Bina

    Hi Bina,
    Lets break the task into smaller steps.
    You can research on Google and search on how to Implement the select date or enter date with Javascript.
    Lets assume that the date has been entered into a text box inside a form inside the HTML code like this:
    <form action ="target.jsp">
       <input type="text" value="" name="dateField"/>
       <input type="submit" name="submit" value="submit" />
    </form>When the user clicks the submit button, the form gets submitted, then the form redirects the user to target.jsp
    Inside target.jsp you can add a date like this
    <%
        String dateField = request.getParameter("dateField");
        // Here use substring function to extract the day , month and year from
    // date field.
        Calendar cal = Calendar.getInstance();
        cal.set(year,month,day);
    // assuming you are storing days in an integer field
    int days;
    cal.add(days);
    %>Note that I have used JSP scriptlets, and the above code is somewhat pseudo-code. Since the task is big I suggest that you break it into smaller more specific tasks and then try to implement them by searching on Google for help first.
    If you get stuck with something specific you can ask here.

  • Click event to add (or subtract) a day to a date field

    I have a form that is giving me a little trouble. I want to be able to input a start date in one field, then input a number of days in another field, and then have it calculate a date that is that number of days away from the start date. The form is actually working ok for the most part, but there are a couple of issues I'm having.
    1. The end date is not calculating immediately upon exiting the number of days field. You have to tab all the way back to the start date and only when you exit that field does it calculate the end date. I need it to calculate when you exit the number of days field.
    2. I have added a little (+) and (-) button to be able to increase or decrease the date by one day. This works, but the problem is, I want to do this in the background. Meaning, I want the calculated date to change, but the # of days field to not change.
    So say I enter 12/1/2010 in the start date. Then I enter 1 in the # of days field. When I tab to the Calculated date field, it should immediately change to 12/2/2010. Then, if I click (+), the Calculated date field should go up to 12/3/2010, but the # of days field should stay at 1.
    I've uploaded a sample of what I have figured out so far here:
    https://acrobat.com/#d=v4c4KKdj0hesicxO8yO1pw
    Thanks so much for any help I can get on this!
    Jo

    I think this is what you are after. I moved the logic to the calculate event of the target date and added a numeric field to hold the result of adding/subtracting (called 'delta').
    // form1.#subform[0].date2::calculate - (FormCalc, client)
    var date1 = Date2Num(date1.formattedValue,"MM/DD/YYYY")
    $.rawValue = Num2Date(date1+days+delta,"MM/DD/YYYY")
    You could make 'delta' hidden.
    Steve

  • How to Add 20 days to a date field

    Dear All,
    I am struck badly on Date manipulation. If somebody has any ideaz on this let me know.
    I want to add some amount of days to system date and then compare it with another date.

    Hi capo9999!
    There are two class to easy and fast manipulate date variables: Calendar and GregorianCalendar.
    You must to read documentation about because there are many details to consider. Date variables has a special structure and do not confuse with "Date class" wich can be used with Calendar and GregorianCalendar.
    An example:
    Calendar today = new GregorianCalendar(); or
    Calendar now = Calendar.getInstance();
    create a new date structure with current date and to manipulate these variables there are methods to add an amount to components. Another example:
    now.add(Calendar.DAY_OF_MONTH, numDays);
    It's amazing to work this way.
    Best Regards.

  • Simple date calculation: add days to a date

    Hi,
    I'm looking for a function module in APO that can simply add a number of days to a date.
    I know I can code (date + days) but would rather a module if possible.
    Thks,
    William

    I know FM /SAPAPO/MSDP_SNPHEU_DAYS_ADD is used in SNP ... but not sure it is suitable for you.

  • Addings days to a date

    In an class assignment how do you add a number of days to a date and then outout in a stored program procedure?

    The same way you would do it in production code :-)
    I won't do your homework, but this should at least point you in the reight direction.
    A date + 1 is the next day, a date - 1 is the previous day.
    If you are running in sqlplus, then the DBMS_OUTPUT package will print to screen. If you are calling from some other language, then you need to pass the procedure an OUT parameter, then deal with displaying in the calling procedure.
    HTH
    John

  • How to select date while Updating record

    I Have created Validation through user api hook on Performance Management Module.but when user enter objective ,if is greater then or less then hundred then system raise error as per policy,but when user enter another objective to meet 100 percent then system raise error "hr object lock " because i am using select statement to sum of that object ,any body idea how to select date while inserting or updating any record.
    Thansks.

    Hi,
    drag and drop a af:convertDateTime on top of the select inputDate component
    <h:form>
    <af:selectInputDate label="Label 1">
    <af:convertDateTime pattern="yyyy-MM-dd hh:mm"/>
    </af:selectInputDate>
    </h:form>
    This adds the current time to the selected dat. In JDeveloper 11 you will be able to explicitly change the time in the calendar
    Frank

  • Adobe LiveCycle Designer 8 - Add days to Current Date in another text field

    Hi-
    I am working on an expense report. I have six fields, CurrentDate, and countDate1 through countDate5. The CurrentDate is a Time/Date field which the user can select whatever date is needed with the drop down calendar. The other five countDate fields are "text" fields which will represent Monday through Friday. I would like to add zero days to whatever the user selects as the CurrentDate and make that appear in countDate1 which represents Monday(the CurrentDate the user selects will always be a Monday), add one day to whatever the user selects as the CurrentDate and make that appear in countDate2 which represents Tuesday...and so on. I realize this is probably basic for someone familiar with FormCalc but I'm very new at this.
    This got me very close but I want the user to select the date and not have the CurrentDate already filled in.
    CurrentDate - DateTime field, FormCalc calculation script:
    num2date(Date())
    Date1 - Text field, FormCalc calculation script:
    Num2Date( Date2Num(CurrentDate.formattedValue))
    Date2 - Text field, FormCalc calculation script:
    Num2Date( Date2Num(CurrentDate.formattedValue) + 1 )
    Thanks!
    Brian

    Here is an exmaple of adding days the script is used in the "exit" event for the date select field that has display format of "MM/DD/YYYY". Adding days requires add x number of days to the days since the epoch date for the current date, adding months or years one needs to manipulate the string parts of the date.
    ----- form1.#subform[0].InputDateField::exit: - (FormCalc, client) ---------------------------------
    // fomatted string for selected date
    var sFmtDateValue = $.formattedValue
    var sMsg = Concat("Entered date formatted: ", sFmtDateValue) // build message string
    sMsg = Concat(sMsg, "\u000a" ) // add new line to message
    // convert date string to days since epoch date - format is important
    var fDaysPast = Date2Num(sFmtDateValue, "MM/DD/YYYY")
    // add 7 days to days past epoch date
    var f7DaysPlus = fDaysPast + 7 // add 7 days
    var s7DaysPlus = Num2Date(f7DaysPlus, "MMM DD, YYYY") // format string for 7 days plus
    sMsg = Concat(sMsg, "\u000a", "Plus 7 Days: ", s7DaysPlus) // build message string
    // add 14 days to days past epoch date
    var f14DaysPlus = fDaysPast + 14 // add 7 days
    var s14DaysPlus = Num2Date(f14DaysPlus, "MMMM DD, YYYY") // format string for 7 days plus
    sMsg = Concat(sMsg, "\u000a", "Plus 14 Days: ", s14DaysPlus) // build message string
    // display results
    // work on months
    // get parts of date past epoch date
    var sFullYear = Num2Date(fDaysPast, "YYYY") // get 4 digit year form days past epoch date
    var sMonth = Num2Date(fDaysPast, "MM") // get month form days past epoch date as number
    var sDate = Num2Date(fDaysPast, "DD") // get date form days past epoch date as a number
    var s2Month = Sum(sMonth, 2) // add 2 months
    var s2FullYear = sFullYear
    // if more than 12 months in new date adjust year on number of months
    if (s2Month > "12") then
    s2FullYear = Sum(s2FullYear, + 1) // increment year
    s2Month = Sum(s2Month, - 12) // adjsut months
    endif
    var s2MonthsAdded = Concat(s2Month, "/", sDate, "/", s2FullYear) // date string
    sMsg = Concat(sMsg, "\u000a", "Added 2 months: ", s2MonthsAdded) // display stringxfa.host.messageBox(sMsg, "Sample Adding Days" ,3, 0);
    var s5Month = Sum(sMonth, 5) // add 5 months
    var s5FullYear = sFullYear
    // if more than 12 months in new date adjust year on number of months
    if (s5Month > "12") then
    s5FullYear = Sum(s5FullYear, + 1) // increment year
    s5Month = Sum(s5Month, - 12) // adjsut months
    endif
    var s5MonthsAdded = Concat(s5Month, "/", sDate, "/", s5FullYear) //build Date string
    sMsg = Concat(sMsg, "\u000a", "Added 5 months: ", s5MonthsAdded) // display stringxfa.host.messageBox(sMsg, "Sample Adding Days" ,3, 0);
    // display results
    xfa.host.messageBox(sMsg, "Sample Adding Days and Months" ,3, 0);

  • How i can add days to a date using sql

    Hi.
    Sorry the question, it's a very simple question, but i'm not finding the answer to that.
    I need some function that act just like the function add_months, but instead adding months, it need to add days to a date.
    I've used the function add_days once, but now, my select returns an error code when i try to use that function.
    My Oracle version is Oracle8 8.0.5.0.0
    runnig under Linux.
    Thanks,
    Klaus Paul

    To add days just do date arthmetic. Ex
    SQL> select sysdate+10 from dual;
    SYSDATE+1
    05-MAR-00
    add_days is a not Oracle date function.
    null

  • How to add 2 days to a date field?

    How to add 2 days to a date field if a Saturday was selected on a different date field?
    Thanks

    I am attempting to add a date field and then have a another field add an amount to a box if the date is less than 30 days. Later I want to update the form to have the today's date is less than 10 days.
    Early Registration Fee is $10.00 if posted by February 25, 2008
    Late Registration Fee is $20.00 if posted by March 17, 2008
    It seems simple, but, when you get to be 71 years old, it seems difficult. Any help will be appreciated.
    Here is a link to the form I'm working on:
    http://www.aworldwide.com/Gideon/Convention_Registration.pdf
    I am using a trial version of Adobe Acrobat 8.
    Thanks,
    Andy Anderson

  • Add 60 days to a date

    Hi!
    I have a date object called "CLOSED_DATE" that I get from av database view. I would like to add 60 days to this date.
    If CLOSED_DATE = "20080501", the new date should be "20080629", that should be put into a variable (NEW_DATE) for futher use
    Thanks for all the help!
    Best regards
    Helge

    H helge
    1 Go to close date & right click on it.
    2 now on restriction select closing_date & again select it
    3 now select 'Set offset for variable" & add 60 in that column.
    the variable is ready to use. just save it
    Assign points if useful
    Cheers
    SM

  • Datepicker - setting selected date as current date plus 3 days

    Hi,
    I have a datepicker in my visual webpart.
    I want to set by default as "today's date + 3 days".
    Example: if today is 25 Feb, then the datepicker should have selected date as 28
    I am aware of this:
    DTDefaultDate.SelectedDate = DateTime.Today;
    How to add the 3 days to it?
    Thanks

    Hi,
    If you want to set the DateTimeControl to a specific date, please take the code below for a try:
    DateTimeControl1.SelectedDate = DateTime.Today.AddDays(3);
    More information about DateTime.AddDays Method:
    https://msdn.microsoft.com/en-us/library/system.datetime.adddays(v=vs.110).aspx
    Thanks
    Patrick Liang
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support,
    contact [email protected]
    Patrick Liang
    TechNet Community Support

  • Add number of business days to date field

    Hello, I noticed that there is not much discussion in the forum surrounding u201Cbusiness daysu201D so I hope this post/discussion/solution contributes to the content of this forum.
    I am using the following 3 formulas to try to Add number of business days (based upon a table field) to a specified date:
    1. Variable name = SetVar
    //Set Variable for Add Business Days:
    DateVar Array Holidays;
    DateVar Target:= CDate({TMS_MOVEMENT_EVT.EVT_DATE}); // Put your field name in here
    NumberVar Add:=  {DTCI_DOD_TRANS.TRANS}; // put the number of days here to add (a positive number)
    NumberVar Added := (0);
    2. Variable name = AddBizDays
    //Adding Business Days:
    EvaluateAfter({@SetVar});
    WHILE Added < Add
    Do (target := target +1;
        if dayofweek (target) in 2 to 6 and not (target in holidays)
            then Added:=Added+1
            else Added:=Added);
    Target
    3. Variable name = HOLIDAYS
    //Holiday Array Formula for the report Header:
    BeforeReadingRecords;
    DateVar Array Holidays := [
    Date (2003,12,25),   // you can put in as many lines for holidays as you want. 
    Date (2003,12,31)
    0
    I am successfully getting my data needed to make the necessary calculations and variable assignmentsu2026 I believe that my ISSUE is that I am not sure where to place these formulas into my report so they assign the variables and execute properly when previewing my report. I am curious if that is my issue, and if so, can someone provide me direction on where to put each of these formulas in my report.
    Currently, when I try to preview the report, I get the following Crystal Reports Error:  -u201CA number, currency amount, Boolean, date, time, date-time, or string is expected here.u201D
    Then Crystal automatically opens the AddBizDays formula and highlights the word added, see below RE: u201CWHILE Addedu201D
    For reference, my report has 3 groups, and I am displaying all of my output information (and locating my formulas) in the group footer #3 report section. I have moved them around to other report sections/groups/placements, but to no success.
    Thanks so much.
    Best, Matt

    I worked this out... FYI - for the benefit of all forum users:
    ADDING BUSINESS DAYS TO A CERTAIN DATE (excluding weekends and holidays)
    1. Variable name = AddBizDays
    //Adding Business Days:
    WhileReadingRecords;
    DateVar Array Holidays;
    DateVar Target:= CDate(); // Put your field name in here
    NumberVar Add:=  ; // put the number of days here to add (a positive number)
    NumberVar Added := (0);
    WHILE Added < Add
    Do (target := target +1;
        if dayofweek (target) in 2 to 6 and not (target in holidays)
            then Added:=Added+1
            else Added:=Added);
    Target
    2. Variable name = HOLIDAYS
    //Holiday Array Formula for the report Header:
    BeforeReadingRecords;
    DateVar Array Holidays := [
    Date (2003,12,25), // you can put in as many lines for holidays as you want.
    Date (2003,12,31)
    0
    ...too bad i don't get forum points for sharing this solution.
    Special thanks to KenHamady.com -- for sharing this solution.
    Sincerely,
    Matt

  • Add number of days to a date

    Hi, all
    somebody know if i can add days to a date with a dynamic action??
    Thank for your help

    Hi Francisco,
    You can use a external subroutine to do so.
    In the dynamic action:
    for that infotype you can specify an entry with Step type F and Variable function part with the routine name(The new calculated date is returned in the RP50D-DATE1 field)
    EXAMPLE:
    STEP1 :In dynamic action create these 2 entries
    0000|     |    | 06 | 457 |  F  | GET_DATE(ZHPADYN).
    0000|     |    | 06 | 456 |  W | P0041-DAT01=RP50D-DATE1
    STEP2: Then create Subroutine pool in SE38 ( Program type S)
    PROGRAM  ZHPADYN.
    TABLES : RP50D,
             P0000.
    *&      Form  GET_DATE
    FORM GET_DATE .
      RP50D-DATE1 = P0000-BEGDA - 1.
    ENDFORM.                    "GET_DATE
    Hope this helps.
    Thanks,
    Puneet

  • How To Add Days into a Date from java.util.Date class

    I have a problem when i wants to add 2 or days into a
    date object geting by java.util.Date class. so please help me resolve this issue?
    for e.g i have a date object having 30/06/2001,
    by adding 2 days i want 02/07/2001 date object ?
    Code
    public class test2
    public static void main(String args[])
    java.util.Date postDate = new java.util.Date();
    myNewDate = postDate /* ?*/;
    Here i want to add 2 date into postDate

    Use Calendar...
    Calendar cal = Calendar.getInstance();
    cal.setTime(new Date());
    cal.add(Calendar.DAY, 2); // I'm not sure about that "DAY"

Maybe you are looking for