How to calculate Hour, Minutes and Seconds from a TIME?

AlagarAlagar Member Posts: 100
Dear All,
I have a variable with Time Datatype it has a value time. i want to split hr, Minutes and Seconds. Help me...

Comments

  • lvanvugtlvanvugt Member Posts: 774
    Did you already study the C/SIDE Reference Guide (aka MS Dynamics NAV 2009 SP1 Developer and IT Pro Help) as delivered with NAV or online? Have a look here: http://msdn.microsoft.com/en-us/library/dd301131(v=NAV.60).aspx.
    Luc van Vugt, fluxxus.nl
    Never stop learning
    Van Vugt's dynamiXs
    Dutch Dynamics Community
  • matteo_montanarimatteo_montanari Member Posts: 189
    Alagar wrote:
    Dear All,
    I have a variable with Time Datatype it has a value time. i want to split hr, Minutes and Seconds. Help me...

    Hi

    Hours, Minutes, Seconds and Millisecond are integer.


    Milliseconds := TIME - 000000000T;

    Hours := Milliseconds DIV 1000 DIV 60 DIV 60;
    Milliseconds -= Hours * 1000 * 60 * 60;

    Minutes := Milliseconds DIV 1000 DIV 60;
    Milliseconds -= Minutes * 1000 * 60;

    Seconds := Milliseconds DIV 1000;
    Milliseconds -= Seconds * 1000;

    MESSAGE('%1 %2 %3', Hours, Minutes, Milliseconds);

    Bye

    Matteo
    Reno Sistemi Navision Developer
  • krikikriki Member, Moderator Posts: 9,110
    [Topic moved from 'Navision Attain' forum to 'NAV/Navision' forum]
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • AlagarAlagar Member Posts: 100
    Thanks for reply..
Sign In or Register to comment.