MS Access Date Expression
In Access, any expression that can be interpreted as a date, including date literals, numbers that look like dates,
strings that look like dates, and dates returned from functions. A date expression is limited to numbers or strings,
in any combination, that can represent a date from January 1, 100 to December 31, 9999.
The values for a year can be from 100 through to 9999.
Some valid date examples:
- 04-Aug-1996
- Aug-04-1996
- 04-August-1996
- 8/4/1996
- 8-4-1996
- 8/04/1996 3:24:00 PM
When you enter data to a Date/Time field, Access enforces the right format that can be interpreted as a date.
If you enter 4.7.1996, Access would prompt the invalid data message.
Or if you enter 4-7-1996 to a datetime field, Access would automatically change it to 4/07/1996 as the valid format.
How to change the way date and time are displayed
In Access Datasheet View, how a Date/Time value is displayed is determined by the format set in
the Regional Options (within Control Panel).
- Click Start (normally located at the bottom-left corner of your Windows screen)
- Then select Settings.
- Click Control Panel
- Double click Regional Options
To change the display format, edit the value in "Short date format:" or "Long date format:".
After you have done, click Apply. Then you will see current date showing in the "Short date sample:" or
"Long date sample:". This way, you can test out many different formats and select the one suits you.
How dates are stored
Within Access engine, dates are stored as part of a real number. Date variables are stored as 64-bit (8-byte) numbers.
The value to the left of the decimal represents a date, and the value to the right of the decimal represents a time.
Negative numbers represent dates prior to December 30, 1899.
Copyright© GeeksEngine.com
| Other Recent Articles from the MS Access category:
|