calculation with time fields

21 views
Skip to first unread message

Michael Werren

unread,
Jun 15, 2015, 10:42:13 AM6/15/15
to cenos...@googlegroups.com
I like to add two HH:MM formated fields to a summary

var t1 = this.getField("Time1").value;
var t2 = this.getField("Time2").value;
this.getField("TimeTotal").value = t1 + t2;

but this will add the string like 00:15 + 00:15 to 00:1500:15

any idea how I have to solve this?





Yang Lu

unread,
Jun 15, 2015, 12:06:45 PM6/15/15
to cenos...@googlegroups.com

Hi Michael,

 

Thanks for asking.

 

If my understanding is correct, your goal is to sum the time span, not the time. I think the first thing is to parse the time as I do not think the “getField("Time1").value;” can return the value internally as a time. You will need to write a custom parser for that. You can probably convert the time span into seconds; then add them together.

 

This post can probably give you some ideas:

http://stackoverflow.com/questions/141136/calculate-timespan-in-javascript

 

Thanks,

Yang

--
You received this message because you are subscribed to the Google Groups "CenoPDF Support Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cenosupport...@googlegroups.com.
To post to this group, send email to cenos...@googlegroups.com.
Visit this group at http://groups.google.com/group/cenosupport.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages