totn Access

MS Access 2007: Define a custom format for a Date/Time field on a form

This MSAccess tutorial explains how to define a custom format for a date/time field on a form in Access 2007 (with screenshots and step-by-step instructions).

Question: In Microsoft Access 2007, how can I define a custom format for a Date/Time field on a form? I want to display the date as "01-JAN-2005 21:00:00", even when I move the cursor to another field.

Answer: In Access, you can use the Format property to customize how a date will appear in a form.

For example, if you wanted to view the date as "04-Mar-2012 21:30:00", you could enter the following into the Format property on your text box:

dd-mmm-yyyy h:nn:ss

Microsoft Access

Then when you viewed the form, the text box would display the date as follows:

Microsoft Access

If you wanted to view the date as "04-Mar-2012 9:30:00 PM", you could enter the following into the Format property on your text box:

dd-mmm-yyyy h:nn:ss AM/PM

Microsoft Access

Then when you viewed the form, the text box would display the date as follows:

Microsoft Access