MS Access Date() Function
The Date()
function in MS Access provides a simple way to retrieve the current system date. It's very useful for adding timestamps to your data, creating date-based reports, or performing date-related calculations.
Date(): Definition and Usage
Date()
is frequently used to record the date a database record was created or modified, to generate time-sensitive reports, or to perform date-based analysis within your MS Access applications. The exact format of the date will depend on your system's regional settings (short date, long date, etc.).
Syntax
The Date()
function is straightforward; it doesn't require any parameters:
Syntax
Date()
Parameter Values
The Date()
function doesn't take any parameters.
Example
Retrieving Today's Date
This example uses Date()
in a query to display today's date alongside customer names from the 'Customers' table (assuming a table named 'Customers' exists with a 'CustomerName' column).
Syntax
SELECT CustomerName, Date() AS CurrentDate
FROM Customers;
Output
CustomerName | CurrentDate
--------------------------
(Customer names from the Customers table) | (Today's date, in your system's date format)