Need Help Creating Timesheet in Adobe Acrobat

New Here ,
Mar 16, 2021 Mar 16, 2021

Copy link to clipboard

Copied

Hi all, 

I am new to using adobe acrobat and am very confused. I want to convert and old timesheet that had been made in excel into a fillible form on adobe acrobat. I am having trouble with the calulations for the total hours (military time). In excel the sheet calculates using the formula under the hours cell is  =MOD(G8-F8,1) where G8 is time out and F8 is time in. How would I do this in adobe so that I get the same result?

All I want is a simple time in, time out, and total hours, and I want to make sure it can calculate if the times go beyond midnight. 

I would appreciate as much info as I can get, thanks!

TOPICS
How to

Views

104

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct Answer

New Here , Mar 16, 2021 Mar 16, 2021
I actually found the answer in a different post! Thanks to try67, kudos to you!! The only difference is that in my script I had "TimeInRow1" instead of "Time 3.1" and "TimeOutRow1" for "Time 4.1". Hope this is helpful for anyone that needs!!var start = this.getField("Time 3.1").valueAsString; var finish = this.getField("Time 4.1").valueAsString; if (start=="" || finish=="") event.value = ""; else { var startArr = start.split(":") ; var finishArr = finish.split(":") ; var hourDiff = finishAr...

Likes

Translate

Translate
Adobe Community Professional ,
Mar 16, 2021 Mar 16, 2021

Copy link to clipboard

Copied

I've moved this from the Using the Community forum (which is the forum for issues using the forums) to the Acrobat forum so that proper help can be offered.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 16, 2021 Mar 16, 2021

Copy link to clipboard

Copied

I actually found the answer in a different post! Thanks to try67, kudos to you!! The only difference is that in my script I had "TimeInRow1" instead of "Time 3.1" and "TimeOutRow1" for "Time 4.1". Hope this is helpful for anyone that needs!!

var start = this.getField("Time 3.1").valueAsString;
var finish = this.getField("Time 4.1").valueAsString;

if (start=="" || finish=="") event.value = "";
else {
	var startArr = start.split(":") ;
	var finishArr = finish.split(":") ;

	var hourDiff = finishArr[0] - startArr[0];
	var minDiff = Math.floor(((finishArr[1] - startArr[1]) / 60)*100);
	if (minDiff<0) {hourDiff--; minDiff += 100;}
	if (hourDiff<0) hourDiff+=24;
	if (minDiff.toString().length == 1) minDiff = '0' + minDiff;
	event.value = hourDiff + "." + minDiff;
}

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 16, 2021 Mar 16, 2021

Copy link to clipboard

Copied

LATEST

Just a tip, not sure what format you need, but for example lets say time diff is 7h and 30min,  the above code will give you 7.50 instead of 7:30.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines