Solved

returning a date equal to tomorrows date at a certain time

Posted on 2002-04-17
1
164 Views
Last Modified: 2010-05-02
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
Paul
0
Comment
Question by:skintpaul
1 Comment
 
LVL 18

Accepted Solution

by:
mdougan earned 50 total points
ID: 6947623
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
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now