I want date difference formula

  • Thread starter Anirudh Singh Chauhan
  • Start date
A

Anirudh Singh Chauhan

I am facing date difference logic problem there is no formula in Infopath
about datediff
 
V

virgul

hi,

unfortunalty not you have to do that with code (If you want I have a
little example)!

++
 
V

virgul

Sorry for the delay of my answer!!!

In which language? I have for JScript or C#!

++

Thierry
 
S

Sandeep

Hi Anirudh Singh Chauhan

This code is infopath Vbscript managed code.

Expl:
Field1 and field2 two are date pickers.
Field3 is textbox
Past this code

Sub CTRL18_5_OnClick(eventObj)

Dim nodeDate1
Dim nodeDate2
Dim dt1Val
Dim dt2Val
Dim daysElapsed

Set nodeDate1 = XDocument.DOM.selectSingleNode("/my:myFields/my:field1")
Set nodeDate2 = XDocument.DOM.selectSingleNode("/my:myFields/my:field2")

dt1Val = CDate(nodeDate1.Text)
dt2Val = CDate(nodeDate2.Text)

daysElapsed = DateDiff("d", dt1Val, dt2Val)

XDocument.DOM.selectSingleNode("/my:myFields/my:field3").text = daysElapsed
End Sub

I hope this will help U
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top