These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

How do I add time together in LiveCycle??

ade670
Registered: Jun 11 2010
Posts: 5

Hi guys,

I am getting frustrated that LiveCycle cannot do what what I thought would be a pretty straight forward process.

I am generating a form which calculates the total duration of pieces of music to form a performance total in minutes and seconds only.

There seems to be now way to stop the calculation going beyond the 59 second limit before adding a further minute.

My example is this:

Field one = 4:37

Field two = 3.32

Sum = 7:69

I would like the sum to say : 8:09

Has anyone developed a script for adding duration of time together and maintaining it's format??

Ade

--SID--
Registered: May 4 2010
Posts: 31
have you tried exploring the data and time functions in the scripting reference guide.

i think you can convert the mm:ss (minutes seconds) value to a number and then add them and then back to mm:ss

~~ S I D ~~

ade670
Registered: Jun 11 2010
Posts: 5
Not seen that - can set the fields to numeric or decimal or date/time (choosing time).

Not sure how this would function - so far I am using the calculate (field1,field2...) with the fields set to the Date/time function - time = hous/mins/seconds in the day rather than simply stopwatch style

Ade
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
You will have to write a custom calculation and split the time string of 'minutes:seconds' into separate values for minutes and seconds. Now convert the minutes to seconds and add the minutes in seconds to the seconds to obtain the total seconds. You can then divide the total seconds by 60 to get the minutes with decimal minutes. You can use FomCalc 'Floor' function to truncate the value for the total minutes with decimal minutes to the next lower whole number of minutes. You can then can use FormCalc's 'Mod' function to obtain the remainder of dividing the total seconds by 60. With these values you can then create formatted strings for the minutes and seconds which can be can then be combine into a single formatted character string of 'minutes:seconds'. You will need to use a number of FormCalc string related functions to properly trim and add leading zeros as needed.

See [url=http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=26397]Time Calculations Using FormCalc in Livecycle Designer[/url] for a script doing a similar task with hours and minutes.

George Kaiser