#### Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

Options

# duration in hours format

Member Posts: 94
edited 2008-05-22
I have taken a variable say temp of duration where value are calculated as temp:=(to time-from time).to time and from time both are of time data type.If result is coming as 3 hrs 29 min 50 sec
then i want it to be displayed as 3.49 hrs
How i can do it

• Options
Member Posts: 95
The time is displayed according to your setup done for Time in the Regional and Language Options from your Control Panel.
• Options
Member Posts: 90
Hello,

You can do this by using an int variable for subtracting time. If you have variables time1 and time2 of TIME type then the rezult of (time2 - time1) will be expressed in milliseconds. So, in order to achieve what you want - to express the rezult in hours - you have to divide the integer by 1000 * 60 * 60.
Exemple:

Name DataType Subtype Length
Time1 Time
Time2 Time
Int Integer
```Time1 := 103020T;
Time2 := 113000T;
Int := Time2 - Time1;
MESSAGE('%1',Int/3600000);
```

//Bogdan
• Options
Member Posts: 94
Thanks for the suggestion it is working fine
BBlue wrote:
Hello,

You can do this by using an int variable for subtracting time. If you have variables time1 and time2 of TIME type then the rezult of (time2 - time1) will be expressed in milliseconds. So, in order to achieve what you want - to express the rezult in hours - you have to divide the integer by 1000 * 60 * 60.
Exemple:

Name DataType Subtype Length
Time1 Time
Time2 Time
Int Integer
```Time1 := 103020T;
Time2 := 113000T;
Int := Time2 - Time1;
MESSAGE('%1',Int/3600000);
```