How to Calculate time

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • novercent
    New Member
    • Mar 2008
    • 6

    How to Calculate time

    hi!! hello sir Madam,

    Im currently a Computer Science Student year 3 my teacher give an assingment to create a program.. can you help me? ...my problem is how to calculate the time ...I'll used Combo box for start then another combo box for The end and textbox for the Total hour..what code Iwill use :

    here the format of my program

    cbo1.AddItem " 06:00 AM " and so on.. = starting time
    cbo9.AddItem " 06:00 AM " and so on.. = end time
    txt1.text = total hour

    first condition// sample problem : what is the code
    start = 07:00 PM
    end = 11:00 AM
    total hour = ?

    2nd condition// sample problem : what is the code
    start = 07:00 PM
    end = ?
    total hour = 3:30

    last condition
    start =?
    end = 06:00 AM
    total hour = 3:30


    please help me

    I need to make this so taht I can pass my subbject in proceed to the 4th year

    Thank you very much...
  • lotus18
    Contributor
    • Nov 2007
    • 865

    #2
    You can try DateAdd() function

    Rey Sean

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #3
      I'd suggest you also look into the DateDiff() function, which is specifically designed to calculate the differences between dates and/or times.

      We can't do the work for you, though. See the following standard warning...


      The experts on this site are more than happy to help you with your problems but they cannot do your assignment/program for you. Attempt the assignment/program yourself first and post questions regarding any difficulties you have or about a particular function of the code that you don't know how to achieve.

      Please read the Posting Guidelines and particularly the Coursework Posting Guidelines.

      Then when you are ready post a new question in this thread.

      MODERATOR
      Last edited by Killer42; Mar 18 '08, 01:59 AM. Reason: Corrected "aldo" to "also"

      Comment

      • debasisdas
        Recognized Expert Expert
        • Dec 2006
        • 8119

        #4
        Try to use DTPicker control instead of using combobox.

        Use DateDiff function for the difference in time.

        Comment

        • novercent
          New Member
          • Mar 2008
          • 6

          #5
          Originally posted by debasisdas
          Try to use DTPicker control instead of using combobox.

          Use DateDiff function for the difference in time.

          thank you!! it helps me a lot !!!

          Comment

          • novercent
            New Member
            • Mar 2008
            • 6

            #6
            Originally posted by Killer42
            I'd suggest you also look into the DateDiff() function, which is specifically designed to calculate the differences between dates and/or times.

            We can't do the work for you, though. See the following standard warning...


            The experts on this site are more than happy to help you with your problems but they cannot do your assignment/program for you. Attempt the assignment/program yourself first and post questions regarding any difficulties you have or about a particular function of the code that you don't know how to achieve.

            Please read the Posting Guidelines and particularly the Coursework Posting Guidelines.

            Then when you are ready post a new question in this thread.

            MODERATOR


            I'll use Date different
            my program works already to the 2 condition but but it will not work if the user will input first to the time

            her is the format

            hour = 2
            start time = 05:00 AM
            end time = ?


            thank you...
            Last edited by Killer42; Mar 18 '08, 01:59 AM. Reason: Corrected "aldo" to "also" in quote block

            Comment

            • Killer42
              Recognized Expert Expert
              • Oct 2006
              • 8429

              #7
              I don't think I completely understand the latest question. But if you have a time and a number of hours to add to it, that's where the DateAdd() function would be used.

              Comment

              Working...