Date difference calculation in Repeating Table

Hi friends,

After searching for a while, I still not figuring out how to implement the date difference calculation within the Repeating Table.

e.g.

Date From Date To No.of Days

20/03/2007 22/03/2007 3

24/03/2007 25/03/2007 2

Any idea?

[288 byte] By [PaulYau] at [2008-1-1]
# 1
Please check out articles on our blog http://blogs.msdn.com/infopath/archive/2007/02.aspx around dates and see if you need more information.
AlexeiLevenkov[MSFT] at 2007-9-12 > top of Msdn Tech,SharePoint Products and Technologies,SharePoint - InfoPath Forms Services...
# 2

Paul,

Did you ever find something that works? I am looking for the same calculation and can't seem to get it down.

Mark

MarkBrotherton at 2007-9-12 > top of Msdn Tech,SharePoint Products and Technologies,SharePoint - InfoPath Forms Services...
# 3
Since InfoPath does not have a dateDiff() function just like the new addDays() function in InfoPath 2007, you will have to write code to perform the calculation. I've posted an article that uses C# code: http://enterprise-solutions.swits.net/browserforms/calculate-date-difference-infopath-browser-form-c-sharp-code.htm

SYMWong-A-Ton at 2007-9-12 > top of Msdn Tech,SharePoint Products and Technologies,SharePoint - InfoPath Forms Services...
# 4

Your code works great if you are selecting two dates from the same month.

(IE. Start 8/13/2007 - End 8/15/2007 = 2 days)

However if you select dates from two different months, you will receive an incorrect value

(IE. Start 8/13/2007 - End 9/16/2007 = 3 days)

The same occurs when you choose a different year.

Any solutions?

Anonymousaaaaaaedfr at 2007-9-12 > top of Msdn Tech,SharePoint Products and Technologies,SharePoint - InfoPath Forms Services...
# 5

Thank you for reporting a possible bug. When I have some spare time again, I will take a look at it and if necessary correct it.

SYMWong-A-Ton at 2007-9-12 > top of Msdn Tech,SharePoint Products and Technologies,SharePoint - InfoPath Forms Services...

SharePoint Products and Technologies

Site Classified