• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 192
  • Last Modified:

returning a date equal to tomorrows date at a certain time

What is the smartest way or getting the value of the date and time for tomorrow at 5pm
Dim x
x = Now + 1
returns tomorrows date
But I also want to set the time part of the value to 5pm ?

Any help appreciated
1 Solution
I'm surprised that Now + 1 works.  Normally, this is how I'd code that:

Private Sub Command1_Click()
Dim x As Variant

x = CDate(Format(DateAdd("d", 1, Now()), "mm/dd/yyyy") & " 05:00:00 PM")
Me.Print x
End Sub
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now