Adobe LiveCycle Designer 8 - Add days to Current Date in another text field
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.
Your date fields should also be a text field as the scrips are establishing the formatting of the data.
The date and time functions are dealing with a formatted string that is either being converted to a number or a number being converted to a formatted field and the script need to know the exact format for converting this data.
Thanks for your help! With the above script you gave me it is working. However, are you referring to the "CurrentDate" Date/Time field being a text field as opposed to the Date/Time field which allows the user to select a date from the calendar because of formatting issues. As of now I have it as a Date/Time field but it automatically populates with the current date. You must click on the calendar to edit it. When you do click on the calendar and select a new date it asks "Are you sure you want to edit this field".
Also, when you do edit the calendar, if you go backwards more than one week it incorrectly calculates the other Date1 through Date5 text fields by starting at Jan. 01 1900. You can go forward as much as you like and there is no problem with that.
I am trying to do something close to this and I have tried un-succesfully to use the script you wrote.
My problem is I have a Date Field (Picker) that picks a date in the future. I need to include on my form several fields that automatically displays dates that are in the future at various intervals like 6 mo. - 5 mo. - 2 mo. - 14 days - 7 days out from the original date selected.
I tried to use both date and text field types but I have yet to get it to work.
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.
xfa.host.messageBox(sMsg, "Sample Adding Days and Months" ,3, 0);
Is it possible to email a sample 3 line 3 field pdf form to you or anyone that can help.
Unfortunately for me this is the first time for me using LiveCycle Designer. I think I have a handle on most of it but writing scripts is currently beyond my capability. I have created a simple three line pdf file that contains 3 fields. The first field is a date picker that the user chooses a FUTURE DATE. The other two fields I want to be automatically filled in depending on the future date selected in the first field. The other two fields should calculate dates BEFORE the date selected.
What I am trying to set up is when a FUTURE DATE (which can change) is selected using the date picker the other FIELDS displays time periods BEFORE the FUTURE DATE as (earliest DATE to START) and ( the last possible DATE to FINISH)
This is part of a TO DO LIST with a SET TIME for completion of the project.
BY JULY 10, 2009 (DUE DATE) Items A thru D must be completed between February 10, 2009 and March 10, 2010 (6 MONTHS to 5 MONTHS prior to DUE DATE.
Items E thru J must be completed between March 10, 2009 and April 10, 2010 (5 MONTHS to 4 MONTHS prior to DUE DATE.
Items K thru N must be completed between April 10, 2009 and May 10, 2010 (4 MONTHS to 3 MONTHS prior to DUE DATE.
And so on until finally a date no later than one week prior to the DUE DATE.
Thanks for your time and consideration
I have a similar problem. I have a DateTimeField3 which has a date to be entered. In DateTimeField4 I want it to calculate the date plus 280 days. I am at a loss on how to do this. I have tried to put the script $ = num2date(DateTimeField+280) in the DateTimeField4 but get no results.
Can you help?
I'm in the same boat as Allan. I'm trying to add 14 to the current date. Nothing seems to work. Any ideas? Thanks.