Question:

Specific minute add with current Time (not date) i.e.1 minute or 2 minute etc.?

by  |  earlier

0 LIKES UnLike

Dear Friend

I want to add 1 minute or 2 minutes with the current time and want to display the time only (not date) in a Text Box under click event of a command button. But it doesn’t work. The code is as follows:

Private Sub Command1_Click()

Dim d1 As Integer

d1 = DateAdd("n", 60, Now())

text1.text=d1

End Sub

N.B. I have also tried by TimeValue function, but doesn’t work.

Please help as soon as possible.

Regards

Pervez

 Tags:

   Report

1 ANSWERS


  1. You can do this very simply with this macro:

    Private Sub Command1_Click()

    Text1.Value = Format(Now() + 2 / (24 * 60), "hh:mm")

    End Sub

    Change the '+ 2' to whatever amount you want to add to the current time.

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.