Date Literals
Date literals can be enclosed within number signs (#) when using the "Date" data type.
Although when assigning a date to a Date variable this can also be done in a string format (eg Noon = #12:00:00# or #1/12/2002#. StartTime = Now().
When assigning a date to a date variable you can also use a valid date string format.
For example the following are all valid
You can also use double quotation marks but this is not very common and takes slightly longer to run
American Format
In VBA dates and times are enclosed between two hash (#) signs, for example:
VBA will automatically adjust the date if it is entered in the "dd/mm/yyyy" format to "mm/dd/yyyy".
VBA will also automatically adjust the time into AM/PM notation if it is entered in 24hr notation.
© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext