University
of Delaware


Year 2000 Examples

Intro

Year 2000 Compliance

Summing up, we have the following:

According to Sun (see their Unix interactive web page), year 2000 compliance requires that the years from January 1, 1970 to January 19, 2038 must be representable by a year 2000 compliant program. This means that if 2 digit year notation is used, the years 70-99 are 1970-1999 and the years 0-38 are the years 2000-2038.

Because a 32 bit integer is used to represent the time (in seconds) that passes from the "epoch" 1970 when using 4 digit years, the years from 1901 thru 1970 and up to 2038 are representable. But for two digit years like 55, there we expect that the program will fail. Is '55 1955, 2055?

In the examples below try various dates in the year 2000 compliant range, 1970-2038 and try dates outside the range.

Note that there the maximum date via these examples was December 31, 2037. That is, January 1, 2038 failed. I need to talk to Sun about this. Also note that the four digit years in the range 1902 - 1970 also work under Solaris 2.6, but not Solaris 2.5.

Some notes about using the Java program which calls the Date Class....... (fill in later).

Program Y2000 and Y2000_usage

(explanation of the output from these programs)

Year 2000 Examples

Example 1: Calls to the procedure "getdate"

C routine "getdate" takes a string containing date information and outputs values of day, month, and year (and ???0). The format of the string is defined in a template file. In this example the template file, "timetemplate.txt", is


          %m
          %A %B %d %Y, %H:%M:%S
          %A
          %B
          %m/%d/%Y %I %p
          %m/%d/%y %I %p
          %d,%m,%Y %H:%M
          at %A the %dst of %B in %Y
          run job at %I %p,%B %dnd
          %A den %d. %B %Y %H.%M Uhr
          %m/%d/%y %T
          %m/%d/%Y %T

where, for example,

	  %m/%d/%y %I %p

indicates the the form month/day/<2-digit year> <12-hour clock time> is acceptable. For example,
	12/01/97 5 pm
and the same form above with %y replaced by %Y means that the full 4 digit year is acceptable. For example,
	12/01/1997 4 am

The routine "getdate" is called in a C program called test5. To run test5, enter date information that is of any of the examples shown below:


	10/12/1988 3 pm

	10/12/88   5 am

Enter a date and time

Note: The form of the entry is presently restricted to:

     month/day/2 or 4 digit year   12 hour clock hour am or pm 
     month day year 12 hour or 24 hour clock time

For example

     1/1/37 11 pm
     1/1/1937 11 pm
     January 1 1938 11:01:33 pm

   Date and Time:   
Submit the date and time to the getdate routine


Example 2: Using the Java Date Class

Here we've limited the input to the program that calls the Date class to a string input. Examples are:

		01/01/1990
		01/01/90
		01/01/1988 00:10:22
		01/01/88   04:00 pm
		10/10/1971 01:01:44 pm
		January 10 1998 10:10:33 pm
		January 10 1998 22:10:33
Note that there you do not use a "," to separate the year and the time in the last two examples.

Enter a date and time (see examples above):

   Date and Time:   
Submit the date and time to the Date Class


-------

Example 3: Time Elapsed Between Two Dates Using the Date Class

As long as two dates are within the year 2000 compliant range, the time elapsed between the two dates can be computed using either 4 digit dates or 2 digit dates. Blah, blah, blah,...... (java vs c for in and out, 1900 on, before 1900, etc.)

Enter two dates and times (see examples above):

   Date and Time:   
   Date and Time:   
Submit the date and time to the Date Class


-------

Programs that Process Dates Outside the Year 2000 Compliant Range

(things to do...references...e.g, y2000 book)