Calculating time elapsed

S

srn

I am trying to calculate the number of hours elapsed. I have 2 fields one to
enter the date and time of the event, the second I have tried now() - field1.
I obtain a response of NAN. Any thoughts?
 
A

Anuma (GGK Tech)

Hi,

Can you clarify me one thing. So that i can help you.

What result your are expecting for your solution and which field you want
display in that result?
 
F

Frederik Van Lierde

Hi

So as you know, there is no DateDiff function in InfoPath, in the
future it will be their as InfoPath will use Xpath 2.0.
But meanwhile many articles explain how to use code.

Tnx to Geek Alex Pojidaev, there is a way to do this out-of-the-box,
even within repeating tables

Follow the step by step guide on

http://blueinfopath.wordpress.com/2009/11/03/datedifference-without-code/

In case it work, don't forget to mention this post by leaving a
comment or by rating this post (This helps others also)

Frederik Van Lierde
http://SilverSandsAssociates.com.wordpress.com
Twitter: http://Twitter.com/SilverSands_IT
 
S

Shiva

Hello,

If that second field calculated value is null or empty then it will shows by
default NAN value. If you add same thing in rules like field1 is not equal to
blank then set above value to field2. Then you will not get NAN value.

You will not get result by using above formula like now() - field1.
 
H

H

Hi

I also I'm looking for a code to calculate time difference. The link
you posted calculates the DAY difference. Do you have a link of idea
of how to calculate the hours instead of days?

greets.
 
S

srn

Sorry I have not been on for a while.
The problem is that I am trying to calculate the number of hours elapsed
since an event.
Therefore the calculation should be the time now minus the time when the
event occured. The event may have occured 2 or 3 days previously.
The action we then take is dependant upon the time elapsed.
I have a field where we enetr the time and date of the event. I then require
a field to populate with the number of hours elapsed.
Thanks for all help so far.
 

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