DateTime Calculation


hello.  have form in adobe acrobat x has 2 time/date fields.  following script being used find difference in hours between 2 date/time fields.  there way result returned actual hh:mm?  example, if differnce 8hrs 15min returned 8.25.  there way have returned 8:15?  thank help!  here current script:

 

function date2num.jpg

a nice feature of acrobat forms displayed format not need match field value. can created custom format script convert hours hh:mm. feature allow 1 accumulate elapsed times subtotal, total or grand total in hours display intervals various total in hours , minutes.

 

since formatting repeated several times using document level script conversion cut down on amount of code needs entered , debugged.

 

// document level script convert hours hh;mm format

function num2time(nhours) {

if(nhours == 0) return ""; // 0 hours null srting

else return util.printf("%,201.0f:%,102.0f", math.floor(nhours), (nhours * 60) % 60);

} // end num2time

// end document level script

 

// custom format script

event.value = num2time(event.value);

// end custom format script.

 

the original question , reason provide accumulation of totals:

 

http://forums.planetpdf.com/datetime-calculation_topic745.html



More discussions in PDF Forms


adobe

Comments

Popular posts from this blog

Falang and too many redirects - Joomla! Forum - community, help and support

Infinite loop detected in JErrorInfinite loop detected in JError - Joomla! Forum - community, help and support

logged out from joomla! - Joomla! Forum - community, help and support