Calculation time btw 2 columns

New Here ,
Oct 18, 2017

Copy link to clipboard

Copied

I have 2 columns

N
STD
STA
BLK
110:3512:3502:00
2

Row Number 1: I need calculation btw STA - STD=BLK

Row Number 2: If STA or STD blank, the column BLK script is no any action .

Thank for your help

Message was edited by: yanu hann

TOPICS
Acrobat SDK and JavaScript, Windows

Views

120

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

Calculation time btw 2 columns

New Here ,
Oct 18, 2017

Copy link to clipboard

Copied

I have 2 columns

N
STD
STA
BLK
110:3512:3502:00
2

Row Number 1: I need calculation btw STA - STD=BLK

Row Number 2: If STA or STD blank, the column BLK script is no any action .

Thank for your help

Message was edited by: yanu hann

TOPICS
Acrobat SDK and JavaScript, Windows

Views

121

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
Oct 18, 2017 0
Most Valuable Participant ,
Oct 18, 2017

Copy link to clipboard

Copied

Time calculations in a PDF file are not trivial. Here are several tutorials about this subject:

https://acrobatusers.com/tutorials/working-with-date-and-time-in-acrobat-javascript

https://acrobatusers.com/tutorials/working-with-date-and-time-in-acrobat-javascript-part-2

https://acrobatusers.com/tutorials/working-with-date-and-time-in-acrobat-javascript-part-3

If you don't wish to mess around with writing the code yourself, though, I've developed a tool that allows you to set it up easily and quickly. You can find it here: Custom-made Adobe Scripts: Acrobat -- Calculate Time Differences in a Worksheet

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
Reply
Loading...
Oct 18, 2017 0
Adobe Community Professional ,
Oct 18, 2017

Copy link to clipboard

Copied

Time strings without dates can have issues. Think about what will happen on the dates and times that a local timezone changes from Daylight Savings Time to or from standard time. An hour is gained or lost depending upon the date. Also the time differences can not cross midnight between 2 dates.

If you are sure the time difference will not include the change over times, then you should be able to split the time string into hours and minutes. With the hours and minutes one can compute the the number of minutes since midnight for the same day. The difference in minutes will be the elapsed time in minutes. This number of minutes can then be converted into the elapsed hours and minutes.

If you include the dates for the times then one uses the elapsed milliseconds since the epoch date for the start and end times which can be converted into minutes and then difference can then be converted or formatted as hours and minutes.

You will need to create all scripts using JavaScript statements, so you will need to JavaScript and the Acrobat JavaScript methods and properties.

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
Reply
Loading...
Oct 18, 2017 0
New Here ,
Oct 25, 2017

Copy link to clipboard

Copied

For STD and STA, non formatted in case we manual input by time follow this format (HH:MM).

If it over midnight, we will input manually by +time how much it over.

     Eg: STD(23:55)-STA(25:55) = BLK(02:00).

Note: I really new user in coding.

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
Reply
Loading...
Oct 25, 2017 0
Adobe Community Professional ,
Oct 25, 2017

Copy link to clipboard

Copied

If you do that then you will have to write code to validate the time entry as well as the calculation of the hours and minutes.

How are you going to handle the upcoming time change form Daylight Savings Time to standard time in the Northern Hemisphere or to DST in the Southern Hemisphere?

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
Reply
Loading...
Oct 25, 2017 0