Calculation of time difference

Juergen1101Juergen1101 Member Posts: 3
Hi!
How can I calculate the difference between two times in hours?

For example: Time 1 := 12:30:00T, Time 2 := 14:00:00T. The result should be 1.5

Thanks
Jürgen

Comments

  • JJ Member Posts: 10
    if you do the following:
    Duration := "Time 2" - "Time 1"
    

    Duration is the timespan in milliseconds. Just calculate that back to hours yourself.
    Hours := ((Duration / 1000)/60)/60;
    

    Duration is of datatype duration
    Hours is of datatype decimal

    Hope this solves your quest.

    :wink:
  • Juergen1101Juergen1101 Member Posts: 3
    Thanks, it works fine!!
Sign In or Register to comment.