Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Reg : Date Calculation

hi,

I have a from date and to date fields on the adobe form.

And also I have a button on the form.

By default from date and to date is displayed.

Now My req is : whenever the user clicks the button ...the value which is displayed in from date field should be substracted by 7.

for ex : from date field has date sep 10.(by default).

when the user clicks the button ...

from date field should display sep3.(i.e. sep10 - 7 days = sep 3)

I dont know Java Script .

can anyone help?

Former Member
replied

Arjun,

I am not sure if your requirement is possible in JavaScript but can be achived in FormCalc and if you do below steps:-

1. Lets say you have From Date Field named Date1. In Object palette --> Select Field Tab --> Enter / select a value for Display Pattern --> I selected "MM/DD/YYYY" as the pattern.

2. In the click event of the button, select language as FormCalc and add following code:-

if (Date1.rawValue ne null) then
	Date1.formattedValue = Num2Date(Date2Num(Date1.formattedValue, "MM/DD/YYYY") - 7, "MM/DD/YYYY")
else
	null
endif

Note: If you select any other pattern for the Date1 field that make the changes in above code accordingly.

Chintan

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question