cancel
Showing results for 
Search instead for 
Did you mean: 

Time - Subtraction

Former Member
0 Kudos

Hi All,

In my VC Application, there are 2 input fields. When an user enter value in the first input field, the time "T1" would be captured. Similarly, when user enters value in the second input field, that time "T2" would be captured.

T1 - 16:48:20

T2 - 16:50:25

In the third input field, i am calculating the difference of the 2 times and displaying the time as T3 = T1 - T2

IF(STORE@a=="1",#ID[ACA8Y9]@T1 - #ID[ACA8XV]@T2,"Null")

But though there is a time difference of 5 minutes between T1 and T2. I am getting T3 = 0.00

Why is it so? Is there any mistake in the expression. For every time difference, it is giving me the same time? Can any one please help me in resolving this issue?

Thanx and Regards,

Divya

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

To find the Time differences use the Time Functions.

Put the formula TSUB(T1,T2,Units) in the Expression field of T3 .

then replace T1 with @time1 by draging from right side same as for T2 also then mention the Units i.e H or M or S depending upon which difference you need.

Ex:

Time1 = 14:30:45

Time2 = 12:45:15

Then Time3 = TSUB(@Time1,@Time2,'M') ==105.5

Regards,

Govindu

Former Member
0 Kudos

The units are :

Z - Milliseconds

S - Seconds

N - Minutes

H - Hours

Former Member
0 Kudos

Hi All,

I gave the expression like

IF(STORE@next3=="1",TSUB(#ID[ACA8XV]@STR1,#ID[ACA8Y9]@STR1,'S'),"no")

Next3 is printing a value of "1". But the time 3 is still giving a value of 0.00.

Time 1 is 18:29:53

Time 2 is 18:30:55

Time 3 is 0.00 (Next3 value=1)

Why is it so?

Thanx and Regards,

Divya

Former Member
0 Kudos

Hi All,

I tried using TSUB...

IF(STORE@next3=="1",TSUB(#IDACA8XV@STR1,#IDACA8Y9@STR1,'Z'),"no")

i tried with S,Z,M..... Still i am getting the output as

"0.00"... Is there anything else to be done? where am i wrong? Can anyone please help me out in rectifying this issue?

Thanx and Regards,

Divya

Former Member
0 Kudos

hI,

What is your actuall requirement ?

Is it time difference only right.

If yes why you are using if Condition?

and what is the purpose of next3 here?

if next3 contains always 1 then this formula has to return the time difference if not then it will return always Zero value i.e 0.00.

So put directly TSUB(#IDACA8XV@STR1,#IDACA8Y9@STR1,'S') in Expression filed of Time3 inputfiled i.e where you want to get the difference .

is it clear for you otherwise get back to me

Regards,

Govindu

Former Member
0 Kudos

Hi All,

If i use like

TSUB(#IDACA8XV@STR1,#IDACA8Y9@STR1,'S'). It is giving a me a message

"Expected Text Value/Expression". That is y i am going for If Condition. Why it is so?

Thanx and Regards,

Divya

Former Member
0 Kudos

Hi,

now i understood ur problem.

you are added the Timer3 filed type as Text change the data type to time and then do it.

it will work

Regards,

Govindu

Former Member
0 Kudos

Hi,

Thanks. Was able to do it your way.

Thanks,

Divya

Former Member
0 Kudos

Hello,

Yuo can't use the "-" operator on time, you should use the time functions in order to calculate the difference.

In your case you should use the TSUB function.

Regards,

Luba.