Options

From integer to time

gonzy1981gonzy1981 Member Posts: 156
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

Comments

  • Options
    GilGil Member Posts: 49
  • Options
    krikikriki 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
    David_SingletonDavid_Singleton 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
Sign In or Register to comment.