CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Time problems?!

  1. #1
    Join Date
    Jun 2000
    Location
    Canada
    Posts
    37

    Time problems?!

    How do I subtract two time's that are in short form(23:05) to get the difference in a integer.
    Example
    time1 = 15:02
    time2 = 20:02

    total = time2 - time1
    total should be equal to 5 hrs but it doesn't work
    Is there is a function for this.



  2. #2
    Join Date
    Apr 2000
    Location
    Dorado, P.R.
    Posts
    221

    Re: Time problems?!

    datediff("h",time1,time2)



  3. #3
    Join Date
    Jun 2000
    Location
    Canada
    Posts
    37

    Re: Time problems?!

    This is very helpful thank you, but is there a way to get the minutes in a decimal format behind the hours like 7.25 (7 hours and 25 minutes)

    Thank you ahead of time



  4. #4
    Join Date
    Jul 2000
    Location
    UK
    Posts
    37

    Re: Time problems?!

    Try:

    datediff("n",time1,time2)/60

    Regards


    Anne Wright
    Wright Computing

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