Date calculation and formatting

Avatar

Avatar
Validate 1
Level 1
rgfischerjr
Level 1

Likes

0 likes

Total Posts

6 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
rgfischerjr
Level 1

Likes

0 likes

Total Posts

6 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile
rgfischerjr
Level 1

28-05-2015

I have a text box DeliveryDate formatted as Date/Time with binding set to Data Format "DATE" and all patterns set to "MMMM D, YYYY" (which should result in January 5, 2015, etc.).  Dates are picked via the drop down.

I have a floating field LateDueDate formatted as Text, no patterns set.

I am trying to take DeliveryDate and add 30 days and have the result populate LateDueDate.

In the Exit event of DeliveryDate (using FormCalc) I have the following:

EVI_Contract.EVI_Main.PaymentTerms.LateDueDate.formattedValue = Num2Date(Date2Num($.rawValue, "MMMM D, YYYY")+30);

xfa.layout.relayout();

Using various combinations of Num2Date and Date2Num, I have been able to get the function to work on months with short names, i.e. May 1, 2015 will correctly fill LateDueDate with May 31, 2015.  January 1, 2015 results in Jan 1, 1900 - which I recognize is a formatting error -but for the life of me I can't find how to correct it.  I've tried every combination of Num2Date(Date2Num($.rawValue, "MMMM D, YYYY")+30); I can think of, including Num2Date(Date2Num($.rawValue, "MMMM D, YYYYY")+30, "MMMM D, YYYY") and Num2Date(Date2Num($.rawValue +30);, etc.

Thanks in advance!

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 1
Level 4
jasotastic81
Level 4

Likes

35 likes

Total Posts

329 posts

Correct reply

43 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile

Avatar
Validate 1
Level 4
jasotastic81
Level 4

Likes

35 likes

Total Posts

329 posts

Correct reply

43 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile
jasotastic81
Level 4

28-05-2015

This worked for me:

DateField2.formattedValue = Num2Date(Date2Num($.formattedValue, "MMMM D, YYYY")+30, "MMMM D, YYYY")

768960_pastedImage_2.png

768961_pastedImage_3.png

768965_pastedImage_4.png

Answers (1)

Answers (1)

Avatar

Avatar
Validate 1
Level 1
rgfischerjr
Level 1

Likes

0 likes

Total Posts

6 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
rgfischerjr
Level 1

Likes

0 likes

Total Posts

6 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile
rgfischerjr
Level 1

28-05-2015

Thank you!!