FileDocCategorySizeDatePackage
DateUtil.javaAPI DocExample941Sun Sep 02 14:59:06 BST 2001com.oreilly.forum.domain

DateUtil

public final class DateUtil extends Object
Misc utility functions for dates. Methods are synchronized because the same Calendar instance is shared.

Fields Summary
private static Calendar
cal
Constructors Summary
private DateUtil()

    
Methods Summary
public static synchronized intgetDayOfMonth(java.util.Date date)

return
the day of the month for a given date.


                   
          
        cal.setTime(date);
        return cal.get(Calendar.DAY_OF_MONTH);
    
public static synchronized intgetMonth(java.util.Date date)

return
the month number for a given date.

        cal.setTime(date);
        return cal.get(Calendar.MONTH);
    
public static synchronized intgetYear(java.util.Date date)

return
the year number for the given date.

        cal.setTime(date);
        return cal.get(Calendar.YEAR);