Display Duration in HH:MM in page field

kmkaotkmkaot Posts: 211Member
Dear Friends,

Will you advice me how to display duration in simple form. like HH::MM format in page

Warm Regards


  • Slawek_GuzekSlawek_Guzek Posts: 1,050Member
    Use a var of Duration type, or assign an expression endtime-starttime as the source expression.
  • kmkaotkmkaot Posts: 211Member
    I got field with Duration data type. Just I need display in my worksheet type page.

    Warm Regards
  • Slawek_GuzekSlawek_Guzek Posts: 1,050Member
    So it should already format the duration properly for you. What's the problem then?
  • kmkaotkmkaot Posts: 211Member
    It is displaying like 30 hours, 40 miniatures, 25 seconds. It should be like 30::40::25
  • Slawek_GuzekSlawek_Guzek Posts: 1,050Member
    If it is only for displaying (no edit) then add a function on your page preparing the duration in the formatting which suits you.

    Unfortunately FORMAT with a format property will not do, the duration values accepts ony 3 standard formatting string, result none of which is close to what you need. At least I am not aware of any other format string which can be applied to the durartion var

    You would have to do someting like this:
    Hours := ROUND(Duration / (60 * 60 * 1000L), 1, '<');
    Minutes := ROUND(Duration / (60 * 1000L), 1, '<') MOD 60;
    Seconds := ROUND(Duration / 1000L, 1, '<') MOD 60;
    DurationText := STRSUBSTNO('%1:%2:%3', Hours, Minutes, Seconds);
    Or use DotNet vars
  • AKAK Posts: 143Member
    edited 2018-01-11
    There is an easier solution by creating a variable of type time, adding the duration to it and format the result:
    TimeVariable := 000000T + durationVariable;

Sign In or Register to comment.