How to Add Hours and Minutes to current Time .

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Rozeanna Jerry
    New Member
    • Sep 2010
    • 18

    How to Add Hours and Minutes to current Time .

    Hi every one..I am trying to add 8 hours 15 minutes to current time and show the new time on a text box. How would I do that.?

    For example if the current time is 8:00am then adding 8 hours 15 minutes should show 4:15pm.

    Please help.

    Anna
  • colintis
    Contributor
    • Mar 2010
    • 255

    #2
    Using the function DateAdd will do the work, but the function only do one type of calculation at a time, so you can either convert the hours to minutes make a total add up, or use one DateAdd for hours, one for minutes.

    Code:
    Dim LDate As Date
    
    LDate = DateAdd ("n", 495, Time())
    "n" represent minutes, and 495 is adding 495 minutes (8hrs and 15mins) to Time(). But use Now() instead if you are adding time that pass 12 AM to another day.

    Comment

    • Rozeanna Jerry
      New Member
      • Sep 2010
      • 18

      #3
      Thanks..worked out for me..

      Comment

      Working...