Microsoft Office 2000/Visual Basic Programmer's Guide   

Getting the Current Date and Time

Three functions in VBA can tell you exactly when it is: the Now, Date, and Time functions. The Now function returns both the date and time portions of a Date variable. For example, calling the Now function from the Immediate window returns a value like this one:

2/23/98 6:16:47 PM

The Date function returns the current date. You can use it if you don't need to know the time. The Time function returns the current time, without the date.


Send feedback to MSDN.Look here for MSDN Online resources.