Howdy, Stranger!

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

Options

From integer to time

Member Posts: 156
edited 2012-09-05
Hi there,
I've been trying to find the way to convert a varible integer to a varible TIME, but I haven't been able to do it.

For example:

i integer
i := 80;

I just want the time with this format 0h 1m 20s or similar format.

I think it's with the command FORMAT, but ..... ](*,) ](*,) ](*,)
Do you know how to do it??
Thanks

• Options
Member Posts: 49
• Options
Member, Moderator Posts: 9,098
try this:
```int := 80; //the seconds
tim := 000000T;
tim := tim + (int MOD 60) * 1000; // get the seconds
int := int DIV 60; // keep the minutes
tim := tim + (int MOD 60) * 1000 * 60; // get the minutes
int := int DIV 60; // keep the hours
tim := tim + (int MOD 60) * 1000 * 60 * 60; // get the hours

message('%1',tim);
```
Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!

• Options
Member Posts: 5,479
gonzy1981 wrote:
Hi there,
I've been trying to find the way to convert a varible integer to a varible TIME, but I haven't been able to do it.

For example:

i integer
i := 80;

I just want the time with this format 0h 1m 20s or similar format.

I think it's with the command FORMAT, but ..... ](*,) ](*,) ](*,)
Do you know how to do it??
Thanks

message(format(000000T + (80 * 10000)));
David Singleton