Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

How to add 2 days to a date field?

Avatar

Former Community Member
How to add 2 days to a date field if a Saturday was selected on a different date field?



Thanks
6 Replies

Avatar

Level 7
Test the formatted value of the different field for "Saturday" and then do your calculation.

Avatar

Former Community Member
Hello Geo,



Thanks for your reply, thats exactly what I need to do, but how do I do it? I do not have that level script knowledge.

This is the code placed in one of the field to add 1 day to the date field, but I need to add 2 days if the day selected is a "Saturday"



if (DateTimeField1.rawValue ne null) then

Num2Date(Date2Num(DateTimeField1.formattedValue, "EEEE, MMM D, YYYY")+ 1, "EEEE, MMM D, YYYY")



else

null

endif



I really appreciate any help, thanks guys

Avatar

Level 7
My response to your other post:



if (DateTimeField1.rawValue ne null) then

if (Substr(DateTimeField1.formattedValue, 1, 08) eq "Saturday") then

Num2Date(Date2Num(DateTimeField1.formattedValue, "EEEE, MMM D, YYYY")+ 2, "EEEE, MMM D, YYYY")

else

Num2Date(Date2Num(DateTimeField1.formattedValue, "EEEE, MMM D, YYYY")+ 1, "EEEE, MMM D, YYYY")

endif

else

""

endif

Avatar

Former Community Member
Hello Geo,



Thank you, Thank you so much!



It works perfectly, all I did was copy your suggested code and pasted in my date field.



I hope some day I can return this favor to you some way



Thanks!

Avatar

Former Community Member
I ran into the same problem and used the recommended code. But for some reason, it will accept only May month dates and the calculations are correct. Any other dates besides a May date, the calculated fields returns January 1, 1990.



What am I doing wrong?



Thanks!

Avatar

Former Community Member
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