Nancy Winnick Cluts
June 24, 1996
In a few years, we will be in the next century. When the auspicious date of January 1, 2000, comes upon us, will your application continue to function correctly? Will your application interpret that day as being January 1, 2000, or will your application interpret the date as January 1, 1900? (Before anyone jumps on that sentence, let me assure you that I realize that the current century doesn't actually end until December 31, 2000. The twenty-first century begins on January 1, 2001.) This article discusses the techniques you can use in your application to be ready for the year 2000.
Question: To what year does the date 01/01/00 refer?
Answer: 1900, 2000, 2100, and so forth.
The screen shot in Figure 1 is from Microsoft® Schedule+. Notice that the year I specify in the date drop-down list box is 00. From the description, you can see that what I want to do is to set up an appointment for the first day of the year 2000.
Figure 1. Setting an appointment in the year 2000
After clicking the OK button in the dialog box shown in Figure 1, can you guess which year Schedule+ will choose for the appointment?
Figure 2. An appointment in the year 2000
Well, Schedule+ assumes that any two-digit year number less than 80 (that is, before January 1, 1980) refers to a year that has a value equal to that particular year number plus 2000 (that is, 75 refers to 2075, not 1975). In other words, the dates supported within Schedule+ are January 1, 1980 through, December 31, 2079. As a result, I end up with the date that I want.
The screen shot in Figure 3 is from the Date/Time Properties dialog box in Microsoft Windows® 95. Notice that the user is allowed a full four digits for the year. The Date/Time Properties dialog box supports dates from January 1980 to December 2099.
Figure 3. The Date/Time Properties dialog box
I know that I'm going to get at least a couple of e-mail messages from smart alecks who are going to tell me that this solution does not cover years after December 31, 9999. I promise that if anyone is still running Windows 95 in that year and needs an update, I will personally fix it. (I'll be dead, of course, so it may be difficult to actually get the fix.)
Microsoft products are designed to support dates well into the next century. Win32®, the API used for Windows 95 and Windows NT®, stores dates as a 16-bit field and is capable of storing dates for 119 years starting from 1980. This means that applications that use the Win32 format can support dates up to the year 2099. But just because Microsoft is ready doesn't mean that everyone is. For instance, historically, mainframe operating system date formats have not supported years up through the next century.
When the user is allowed to enter dates in a format that allows only two digits (also known as a short date format) to specify the year (that is, in the mm/dd/yy configuration), it is impossible for a computer to tell the difference between a day in 1905 and 2005. Microsoft has been suggesting to software developers that applications should update their date assumptions by 1997 in such a way that dates into the twenty-first century are supported.
Microsoft provides development tools and database management systems that allow people to represent dates in many different ways. Recommendations for safe date formats include the following:
When testing your applications for support of dates outside of the current century, also be sure to test:
The table below shows Microsoft products and the life expectancy of the date formats used for each one. Unless noted, Microsoft products rely on the system-supplied date formats.
Product Name | Date Limit | Date Format |
Microsoft Access 95 (assumed date) | 1999 | Short dates ("yy") |
Microsoft Access 95 (explicit date) | 9999 | Long dates ("yyyy") |
Microsoft Access (next major version) | 2029 | Short dates ("yy") |
Microsoft Excel 95 | 2019 | Short dates ("yy") |
Microsoft Excel 95 | 2078 | Long dates ("yyyy") |
Microsoft Excel (next major version) | 2029 | Short dates ("yy") |
Microsoft Excel (next major version) | 9999 | Long dates ("yyyy") |
Microsoft Project 95 (and previous versions) | 2049 | Short dates ("yy") |
Microsoft SQL Server | 9999 | Datetime function |
MS-DOS® file system (FAT16) | 2108 | Not applicable |
Visual C++® run-time library | 2038 | Not applicable |
Microsoft Foundation Class Library (MFC) | 2038 if using Ctime class 9999 if using ColeDateTime class |
Not applicable |
Visual FoxPro™ | 9999 | Long dates ("yyyy") |
Windows 3.x file system (FAT16) | 2108 | Not applicable |
Windows 95 file system (FAT16) | 2108 | Not applicable |
Windows 95 file system (FAT32) | 2108 | Not applicable |
Windows 95 run-time library (WIN32) | 2099 | Not applicable |
Windows for Workgroups (FAT16) | 2108 | Not applicable |
Windows NT file system (FAT16) | 2108 | Not applicable |
Windows NT file system (NTFS) | Future centuries | Not applicable |
Windows NT run-time library (WIN32) | 2099 | Not applicable |
The bottom line here is that we are coming to the close of the twentieth century. Your applications should be prepared to take this into account when displaying, altering, or storing date values. Using the Win32 built-in date functionality and Microsoft development tools can help you alleviate this problem. In addition, think about using Microsoft Systems Management Server to update large deployments of your software easily.