Date Differences

M

Marc Dimmick

I am trying to display the difference between the two system fields _Created & _Modified

I have found function to do the job but not sure how to get it working back in the form. the script is:

function timeDifference(_Modified,_Created)
{
var difference = _Modified.getTime() - _Created.getTime();

var daysDifference = Math.floor(difference/1000/60/60/24);
difference -= daysDifference*1000*60*60*24
var hoursDifference = Math.floor(difference/1000/60/60);
difference -= hoursDifference*1000*60*60
var minutesDifference = Math.floor(difference/1000/60);
difference -= minutesDifference*1000*60
var secondsDifference = Math.floor(difference/1000);

document.write('difference = ' + daysDifference + ' day/s ' + hoursDifference + ' hour/s ' + minutesDifference + ' minute/s ' + secondsDifference + ' second/s ');
}

No how do I get it to display the value to the form.
 
E

Emily

create a new text field and then define the initial value as "Function" to
see if it works.
 

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

Similar Threads

Using Min Function within DLookup Function 0
hit counter 1
Script question... 3
Excel VBS time difference functions<[email protected] 0
difference in time 2
Wierd Characters 2
IF condition 3
error in code 2

Top