Microsoft KB Archive/95907

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

Article ID: 95907

Article Last Modified on 1/18/2007

-

APPLIES TO


 * Microsoft Access 1.0 Standard Edition
 * Microsoft Access 1.1 Standard Edition
 * Microsoft Access 2.0 Standard Edition
 * Microsoft Access 95 Standard Edition
 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q95907



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



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, 1993).

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

  =Format(Now,&quot;yy&quot;)

  -or-

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

The breakdown of expression 2 is:


 * Now returns the 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

