CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2009
    Posts
    5

    calculate the time

    I need a formula to calculate the difference in Hours and Minutes between two times.
    Example: Table name = Attandance and the fields that need to be calculated are:
    [IN] = 1:15 PM
    [OUT] = 1:44 PM.
    Show Result 0:29.


    Thanks In Advance.

  2. #2
    Join Date
    Jun 2006
    Posts
    5

    Re: calculate the time

    local numbervar sec:=datediff("s",{EMP.EMP_INS_YMDHMS},{DEPT.DEPT_INS_YMDHMS});
    local numbervar days:=0;
    local numbervar hr:=0;
    local numbervar min:=0;
    local numbervar calc;

    calc:=truncate(sec/(24*3600));
    days:=calc;

    calc:=truncate(sec/3600);
    hr:=calc;

    calc:=truncate(sec/60);
    min:=calc;

    sec:=sec mod 60;

    totext(days)+"Day "+totext(hr) +"Hrs "+totext(min)+"Min "+totext(sec)+"Sec";

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured