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

Calculation time btw 2 columns

Guest
Oct 18, 2017 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

301

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 ,
Oct 18, 2017 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

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
LEGEND ,
Oct 18, 2017 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.

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
Guest
Oct 25, 2017 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.

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
LEGEND ,
Oct 25, 2017 Oct 25, 2017

Copy link to clipboard

Copied

LATEST

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?

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