How to get duration in time between 2 time

jlettjlett Member Posts: 9
edited 2008-11-09 in NAV Tips & Tricks
f_duree(VAR _heuredebut : Time;VAR _heurefin : Time) _duree : Time
// _Duree en hh:mm:ss

IF (_heurefin<>0T) AND (_heuredebut <> 0T) THEN BEGIN

_duration := _heurefin-_heuredebut; // duration = integer

_duree := 000000T + _duration; // ***** not _Duration + 0000T ****** ](*,) INCREDIBLE !!!

END;

:D

Comments

  • DenSterDenSter Member Posts: 8,307
    So you're saying that "Time + Duration" works, and "Duration + Time" does not? That is incredible.

    I don't think I would have tried reversing it like that, good catch =D>
  • kinekine Member Posts: 12,562
    It have meaning... result data type is determined by first parameter... it means that T + D = T, D + T = D and it means that Duration + Time is nonsense... ;-)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • DenSterDenSter Member Posts: 8,307
    That makes no sense at all to me. A Duration plus a time can't make another duration, that is ridiculous. You can increase or decrease a duration only by adding/subtracting another duration. 2 hours plus 2 hours equals 4 hours. You can't say 2 hours plus November 8 2008 makres another duration, that makes absolutely no sense at all.
  • kinekine Member Posts: 12,562
    it makes no sense, it is how the C/SIDE works... but it is just my though... ;-)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.