A.5. Date and Time Functions

Calendar Property

Returns or sets the system calendar

Date Property

Returns the current system date as a date

Date$ Property

Returns the current system date as a string

Date Statement

Sets the system date

DateAdd Function

Returns the result of a date/time addition or subtraction calculation

DateDiff Function

Returns the difference between two dates

DatePart Function

Returns the part of the date requested

DateSerial Function

Returns a date from an expression containing month, day, and year

DateValue Function

Returns a date from a representation of a date

Day Function

Returns a number representing the day of the month

Hour Function

Returns a number representing the hour of the day

Minute Function

Returns a number representing the minute of the hour

Month Function

Returns a number representing the month of the year

MonthName Function

Returns the name of the month for a given date[1]

[1] VB6 only

Now Property

Returns the current system time

Second Function

Returns a number representing the second of the time

Time Property

Returns or sets the current system time as a variant

Time$ Property

Returns or sets the current system time as a string

Timer Property

Returns the number of seconds elapsed since midnight

TimeSerial Function

Returns a representation of a given hour, minute, and second

TimeValue Function

Returns a time value from a string representation of a time

Weekday Function

Returns a number representing the ...

Get VB & VBA in a Nutshell: The Language now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.