Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Time calculations with FormCalc

Avatar

Former Community Member

Hello!

I'm trying to create a simple timesheet form in Designer but things don't seem to work the way I expected.

I have two Time fields where users are supposed to inform start and end times for a task. A third time field should display the elapsed time.

So I tried to solve this with FormCalc:

var interval = 0

interval = Time2Num(endTime.formattedValue, "HH:MM") - Time2Num(startTime.formattedValue, "HH:MM")

$.formattedValue = Num2Time(interval, "HH:MM")

It doesn't work. I mean, if I inform startTime = 10:00 and endTime = 11:00, the result is 23:00. How come?

Now, if I inform startTime = 09:00 and endTime = 11:00, the result is 00:00.  Huh?

Please, could anyone tell me what I'm doing wrong here? 

Season Greetings!

Marcos

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

check this thread.

It describes a solution for those kind of calculation.

http://forums.adobe.com/message/4054814#4054814

View solution in original post

3 Replies

Avatar

Correct answer by
Level 10

Hi,

check this thread.

It describes a solution for those kind of calculation.

http://forums.adobe.com/message/4054814#4054814

Avatar

Former Community Member

Hey Radzmar,

This is enough to help me out here!. 

Thanks!!

Marcos

Avatar

Level 1

Hi radzmar, could you please help me with the following question:

http://forums.adobe.com/thread/1317121