Basic HTML version of Foils prepared 18 May 97

Foil 17 The Date class

From Java Tutorial - Spring 1997 Part 4: Multithreading, useful Java classes, I/O, Networking, and the future Peking Tutorial, Web Certificate -- Spring-Summer 1997. by Nancy J. McCracken,Geoffrey C. Fox


This class exists to provide an implementation of "date" structures. As is typical of data encapsulation classes, it has methods to create dates, obtain and set the parts of dates, and convert dates to other data types.
The constructor either creates today's date or any other day (and time) that you provide:
  • Date today = new Date();
  • Date ancient = new Date(999,12,31); /* Dec. 31, 999 */
  • Date deadline = new Date(1996,12,31,23,59,59)
    • /* Dec.31,1996 at 23:59:59 */



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Thu Jan 8 1998