These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Date Subtraction Live Cycle continued

beachbumbali11
Registered: Mar 5 2008
Posts: 74

Well I figured out the basics of my previous problem in case any one wanted the info after a day of trial and error got basics to work but still not there. Took date subtraction method from the Acrobat samples on this site that were java script for acrobat couldnt get the java script in designer to work but got it in form calc which was much simpler. All i wanted to do was subtract two time/date feilds
So if your looking to do it here is the basic
var strStart = (field1.formattedValue, "DD/MM/YY")
var strEnd = (field2.formattedValue, "DD/MM?YY")
$ = strEnd-strStart

PLEASE HELP
But i cant get the freaking IF function to work in form calc not even the most basic one from the manual i get the same error every time. syntax error line 1 near '=' what am i doing wrong going nuts with this

My Product Information:
LiveCycle Designer, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Formatted number field strings also do not work in computations. You have to convert the strings to the appropriate number format using the appropriate methods.

In JavaScript you need to use the "util.scand()" method to the get the date time object and then use other methods to get the number of milliseconds or the parts of the object as needed.

For FormCalc the scripting help file in LiveCycle Designer list the "Date2Num()" function as the method to get the number of days from a date string.

var strStart = Num2Date(field1.formattedValue, "DD/MM/YY")
var strEnd = Num2Date(field2.formattedValue, "DD/MM?YY")
strEnd-strStart

George Kaiser

beachbumbali11
Registered: Mar 5 2008
Posts: 74
Yup sorry forgot to add the Num2Date in the post oops but how do you check field lengths in form calc
and how does this date subtraction calculation using java script in Live Cycle look???