Click here to Skip to main content
15,889,863 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I'm currently looking for a way to get the difference between 2 date time fields in hours. The first "Start Time" is a date time field with its default value as now() while the "End time" is a also a calculated field. The "end time" field is to be populated when the form has concluded its workflow process. i.e. "Start time" picks the time the form is opened by the initiator while "end time" picks the current time as at time of final approval.

Kindly assist on how I go about getting the difference between these two fields.

I have followed the steps on this blog but I get a "NaN" value on both the StartTime and EndTime fields.

http://blogs.msdn.com/b/infopath/archive/2007/02/21/calculating-elapsed-time-without-code.aspx?PageIndex=3[^]

Kindly assist on how I go about getting the difference between these two fields.

Thanks.

Part 2 Question

Hi, this time difference works perfectly for activities that last within the same day. My client has requested for a time calculation that will span across 2 days e.g. if a task(db backup) starts 9pm on Thursday 30th April 2015 and ends 9am on Friday 1st of May 2015.

Any ideas on how I implement this?

Thanks.
Posted
Updated 30-Apr-15 4:22am
v3

1 solution

 
Share this answer
 
Comments
BamideleAriwodola 27-Apr-15 7:44am    
Thank you.
The 2nd blog post eventually worked.
Maciej Los 27-Apr-15 7:58am    
You're very welcome ;)
BamideleAriwodola 30-Apr-15 10:21am    
Hi, this time difference works perfectly for activities that last within the same day. My client has requested for a time calculation that with span across 2 days e.g. if a task(db backup) starts 9pm on thursday 30th April 2015 and ends 9am on friday 1st of May 2015.
Kindly assist on how I go about implementing this requirement.

Thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900