«^»
2.4. Stage A: obtaining the current date and time

To begin with, we need to know how to get the current date and time. The class Date from the java.util package can be used to do this. So the following program can be used to output the current date and time:

0001: //                                                       // GetDateProg.java
0002: // Stage A: outputting the current date and time to the screen.
0003: // Barry Cornelius, 22nd November 1999
0004: import java.util. Date;
0005: public class GetDateProg
0006: {
0007:    public static void main(final String[] pArgs)
0008:    {
0009:       final Date tDate = new Date();
0010:       System.out.println(tDate);
0011:    }
0012: }