![]() |
The Java Developers Almanac 1.4Order this book from Amazon. |
e373. Getting the Current DateCalendar cal = new GregorianCalendar(); // Get the components of the date int era = cal.get(Calendar.ERA); // 0=BC, 1=AD int year = cal.get(Calendar.YEAR); // 2002 int month = cal.get(Calendar.MONTH); // 0=Jan, 1=Feb, ... int day = cal.get(Calendar.DAY_OF_MONTH); // 1... int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK); // 1=Sunday, 2=Monday, ...
e375. Determining the Number of Days in a Month e376. Comparing Dates e377. Determining a Person's Age e378. Determining If a Year Is a Leap Year e379. Determining the Day-of-Week for a Particular Date
© 2002 Addison-Wesley. |