Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Problem with Date calc

Avatar

Level 1

I'm trying to get this FormCalc calculation to work:

Date2Num (form1.Page1_SF.EffectDates.endDate, "M/D/YYYY") - Date2Num (form1.Page1_SF.EffectDates.startDate, "M/D/YYYY")

Evently, I will divide it by 7 to get the number of weeks, but the initial calculation does not want to work after entering in the dates.

Can you tell me what is wrong with my forumula?

Thank you.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Odd. Something strange about the Date2Num format. I changed them in the calculation to "YYYY-MM-DD" and it works. Note it is calculating the number of elapsed days.

if (HasValue(form1.Page1_SF.EffectDates.endDate) & HasValue(form1.Page1_SF.EffectDates.startDate)) then
$.rawValue = Date2Num(form1.Page1_SF.EffectDates.endDate.rawValue,"YYYY-MM-DD") -Date2Num(form1.Page1_SF.EffectDates.startDate.rawValue,"YYYY-MM-DD")
else
  $.rawValue = null
endif
Steve

View solution in original post

4 Replies

Avatar

Level 10

Do the date patterns on each date field match the date patterns on your calculation?

Steve

Avatar

Level 1

Yes, here is the date pattern:

date{M/D/YYYY}

I'm looking at your PDF now.

Avatar

Level 10

If you can forward the form to stwalker.adobe@gmail.com I would be happy to take a look.

Steve

Avatar

Correct answer by
Level 10

Odd. Something strange about the Date2Num format. I changed them in the calculation to "YYYY-MM-DD" and it works. Note it is calculating the number of elapsed days.

if (HasValue(form1.Page1_SF.EffectDates.endDate) & HasValue(form1.Page1_SF.EffectDates.startDate)) then
$.rawValue = Date2Num(form1.Page1_SF.EffectDates.endDate.rawValue,"YYYY-MM-DD") -Date2Num(form1.Page1_SF.EffectDates.startDate.rawValue,"YYYY-MM-DD")
else
  $.rawValue = null
endif
Steve