time calculations

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dillon Mantle

    time calculations


    Hi

    How do I add 1:45 to 1:45 to get 3:00

    Regards
    Dillon Mantle


  • Rick Rothstein

    #2
    Re: time calculations

    > How do I add 1:45 to 1:45 to get 3:00

    You can't... those two times add to 3:30, not 3:00.<g>

    As long as the total won't go over 24 hours,

    Time1 = "1:45"
    Time2 = "1:45"
    Msgbox Format(CDbl(CDa te(Time1) + CDate(Time2)), "h:mm")

    Rick - MVP


    Comment

    • Trousle Undrhil

      #3
      Re: time calculations

      "Rick Rothstein" <rickNOSPAMnews @NOSPAMcomcast. net> wrote in message
      news:UPmdnYb7hO DWB4vdRVn-uA@comcast.com. ..[color=blue][color=green]
      > > How do I add 1:45 to 1:45 to get 3:00[/color]
      >
      > You can't... those two times add to 3:30, not 3:00.<g>[/color]

      Well, to be truthful, you *can*... :) Just use your code, but add and If
      statement to look and see if Time1 and Time2 equals "1:45" then set the
      final answer to "3:00". Viola! He didn't ask how to make it correctly add
      the times together, just to make those two times come out to 3:00. You
      gotta go by command specs and do what they say. Never assume anything. Do
      exactly what they say *or* ask first, then code it. :-D
      [color=blue]
      > As long as the total won't go over 24 hours,[/color]

      Time1 = "1:45"
      Time2 = "1:45"
      if Time1 = "1:45" and Time2 = "1:45" then ' Those sneaky design specs.
      MsgBox "3:00" ' Why would they want this value from those?
      else
      Msgbox Format(CDbl(CDa te(Time1) + CDate(Time2)), "h:mm")
      end if
      [color=blue]
      > Rick - MVP
      >[/color]

      Ken
      undrhil@hotmail .nospam.comc



      Comment

      • Greg Siemon

        #4
        Re: time calculations

        t = #1:45:00 AM#
        t = DateAdd("h", 1, t)
        t = DateAdd("n", 45, t)
        Answer= 3:30

        "Dillon Mantle" <dillonm@dasolu tions.co.za> wrote in message
        news:H_adnciTPb ZHCovdRVn-ug@is.co.za...[color=blue]
        >
        > Hi
        >
        > How do I add 1:45 to 1:45 to get 3:00
        >
        > Regards
        > Dillon Mantle
        >
        >[/color]


        Comment

        Working...