cancel
Showing results for 
Search instead for 
Did you mean: 

time subtracting

Former Member
0 Kudos

Hi All,

I have 2 date time fields intime and outtime.

Now I need to subtract in time from out time to get total working time.The result should be like this.

4.10

So I am doing like this.But getting the error like A number or currency,date fieled required.

Please help

ToText({Command.out_time}, "hh:mm") -ToText({Command.in_time}, "hh:mm")

Accepted Solutions (1)

Accepted Solutions (1)

abhilash_kumar
Active Contributor
0 Kudos

Hi Kalyan,

Try this:

numbervar TotalSeconds := DateDiff("s",{Command.out_time}, {Command.in_time})

numbervar Hours := Truncate(TotalSeconds / 3600);

numbervar Minutes := truncate((TotalSeconds - (Hours * 3600))/60);

numbervar Seconds := Truncate(Totalseconds - (Hours * 3600) - (Minutes * 60));

Hours & ":" & Minutes

-Abhilash

Former Member
0 Kudos

Hi Abhilash,

I am getting result but with -ve sign like -4:10.I need to deduct in time from out time.

If I reverse intime and outtime in 1st line of code I am getting the result.

Please suggest

abhilash_kumar
Active Contributor
0 Kudos

Yes, reverse the fields used in the DateDiff function.

-Abhilash

Former Member
0 Kudos

Many Thanks Abhilash

Answers (0)