Difference b/ween hours into minutes??

This is a discussion on Difference b/ween hours into minutes?? within the C++ Programming forums, part of the General Programming Boards category; Hi all In C++ how do i convert the difference b/ween 2 times in hours into minutes? consider an employee ...

  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    11

    Difference b/ween hours into minutes??

    Hi all


    In C++ how do i convert the difference b/ween 2 times in hours into minutes?

    consider an employee comes in to work in the morning and goes home in the evening.

    timein --> 9.00 AM
    timeout --> 4.00PM

    how would i calculate how many hours he has worked for that day?

    if i were to do the following

    workhours = timeout - timein

    then the o/put would surely be wrong.

    thanx.

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,691
    Use "military" time. For example, 4:00PM can be represented as 16:00.
    Code:
    IF time is in "PM" AND time >= 1:00
       add 12:00 to time
    ENDIF
    gg

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    11
    Thanx a lot

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Minute to hour/minute conversion program
    By Remius in forum C Programming
    Replies: 7
    Last Post: 12-29-2007, 08:39 AM
  2. Time between Military Hours
    By StarOrbs in forum C++ Programming
    Replies: 18
    Last Post: 03-01-2005, 06:46 PM
  3. switch hours and minutes
    By Unregistered in forum C Programming
    Replies: 2
    Last Post: 07-09-2002, 12:30 AM
  4. please help me fix my coding for this assignment
    By sayeem81 in forum C Programming
    Replies: 1
    Last Post: 01-29-2002, 02:45 AM
  5. Converting MInutes to Hours and MInutes
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 08-30-2001, 09:07 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21