Formatting Dates and Times

When you need to display date or time values, you will usually want the data formatted in a specific way. When displaying type Date data, VBA is pretty good at displaying the information in an appropriate format, based on the system settings. In the United States, for example, the system settings typically result in the display of a date/time value as follows:

10/16/01 10:07:32 AM

System Settings

Under the Windows operating system, default formats for displaying dates and times (as well as other items such as currency) are set in the Control Panel, under the Regional Settings icon. When you write code to display a date or time using the system settings, it is the end user's system settings that are used, not yours. ...

Get Office® XP Development with VBA 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.