Read the API for the Calendar class a bit closer.
(for jdk 1.3.1)... the third paragraph shows you how to obtain a GregorianCalendar object with the current date and time.
Then look in the GregorianCalendar API, there is a HUGE code listing, showing you how to obtain any part of that date.
If that all seems like way to much work... there is a 'quick and dirty' way of obtaining the current date and time.
It involves the java.util.Date class. Check the API, and read what it says for the constructor.
(it says it makes a Date object with the current system time). Then look at its toString() method. It says that it converts the Date object to a formatted
String.
If this format is unacceptable, then you would use this Date object in combination with a SimpleDateFormat object, to convert it into whatever format you want.
I admit the formatter is a bit confusing, so here is an example:
In this example,
d is a java.util.Date object. In the API for SimpleDateFormat, it explains what all the dd MMM yyyy, etc... means.
[ February 20, 2002: Message edited by: Mike Curwen ]