Examples of manipulating and calculating dates on forms, reports, and data access pages

Examples of manipulating and calculating dates on forms, reports, and data access pages

The following table lists examples of expressions that you can use in calculated controls on forms, reports, and data access pages.

Expression Description
=Date() Uses the Date function to display the current date in the form of mm-dd-yy, where mm is the month (1 through 12), dd is the day (1 through 31), and yy is the last two digits of the year (1980 through 2099).
=Format(Now(), "ww") Uses the Format function to display the number of the week of the year the current date represents, where ww is 1 through 53.
=DatePart("yyyy", [OrderDate]) Uses the DatePart function to display the four-digit year of the value of the OrderDate field.
=DateAdd("y", -10, [PromisedDate]) Uses the DateAdd function to display a date that is 10 days before the value of the PromisedDate field.
   =DateDiff("d", [OrderDate], [ShippedDate]) Uses the DateDiff function to display the variance in days between the values of the OrderDate and ShippedDate fields.

Notes