5 Replies Latest reply on Dec 4, 2015 7:27 AM by noel g. music

# Date Difference Calculation problem

I am creating a form which should calculate the number of days between two calender dat

es using the Date2Sum expression but my result cell gives me

zeo despite setting the locale and the calculation correcttly. Where could

my problem be?

Darlington Sakwa

• ###### 1. Re: Date Difference Calculation problem

Validate the date patterns on the date fields match the date patterns used in Date2Num. For example, the attached has a start date with the display date pattern date{YYYY-MM-DD} and that matches the date pattern in my Date2Num function call.

// form1.page1.startDateNum::calculate - (FormCalc, client)

if (form1.page1.startDate.isNull) then

\$.rawValue = ""

else

\$.rawValue = Date2Num(form1.page1.startDate.rawValue,"YYYY-MM-DD")

endif

Steve

• ###### 2. Re: Date Difference Calculation problem

Dear Steve,

Thank you for the support.

I actually found out later that the problem was related to the date pattern and I solved the problem.

I am wondering if there is a quick way of excluding weekends in calculating the date difference? This is something I need to implement in a Leave Application Form.

I would like the applicant to enter the start date for leave and the number of days he/she intends to go on leave. The form should calculate the reporting date by excluding the weekend days (Saturdays and Sundays).

Darlington Sakwa

• ###### 3. Re: Date Difference Calculation problem

The attached calculates the number of days between two dates and specifies the number of days that are weekdays and the number of days that are on the weekend. It demonstrates how you can determine the day of the week.

Steve

• ###### 4. Re: Date Difference Calculation problem

Thanks a lot Steve,

This is exactly what I was looking for.

Regards

D N Sakwa

• ###### 5. Re: Date Difference Calculation problem

Hello Steve,
I'm new to creating pdf documents and this is exactly what I've been looking forI realize this is an old thread, but is it possible for your to provide your document without a password so I can learn from your script?

Thank you.