• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

1.5K

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
...

Votes

Translate

Translate
Community Expert ,
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.

Votes

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;
}

Votes

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
Enthusiast ,
Mar 16, 2021 Mar 16, 2021

Copy link to clipboard

Copied

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.

Votes

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
Community Beginner ,
Jun 13, 2022 Jun 13, 2022

Copy link to clipboard

Copied

How to solve this problem? Thanks @Asim123 

Votes

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
Community Expert ,
Jun 13, 2022 Jun 13, 2022

Copy link to clipboard

Copied

Change these lines:

 

if (minDiff.toString().length == 1) minDiff = '0' + minDiff;
event.value = hourDiff + "." + minDiff;

 

To:

 

event.value = (hourDiff + minDiff/60).toFixed(2);

Votes

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
Community Expert ,
Jun 13, 2022 Jun 13, 2022

Copy link to clipboard

Copied

This line is incorrect:

if (minDiff<0) {hourDiff--; minDiff += 100;}

It needs to be:

if (minDiff<0) {hourDiff--; minDiff += 60;}

Votes

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
Community Beginner ,
Sep 26, 2023 Sep 26, 2023

Copy link to clipboard

Copied

LATEST
What column formats did you use?

Hours, numbers, text only..?

Votes

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