Microsoft KB Archive/209663

= ACC2000: How to Display Only the Last Two Digits of Any Year =

Article ID: 209663

Article Last Modified on 6/24/2004

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q209663



Moderate: Requires basic macro, coding, and interoperability skills.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).



SUMMARY
This article describes how to display only the last two digits of the year.

The expression

=Year(Now)

displays all four digits of the current year (for example, 1999).

In order to display only the last two digits of the year (for example, 99), use one of the following expressions:

=Format(Now,"yy")

-or-

=Right(Str(Year(Now)),2)

The breakdown of expression 2 is as follows:
 * Now returns today's date and time.
 * Year(Now) returns the current year.
 * Str(...) converts the date to a String data type.
 * Right(...,2) returns the right two characters.

NOTE: The right two characters are returned as a text value. If you want them to be returned as a number, use the following expression:

=Year(Now) Mod 100

