Class DateUtil


  • public class DateUtil
    extends java.lang.Object
    The DateUtil class contains utility methods for dates.
    • Constructor Summary

      Constructors 
      Constructor Description
      DateUtil()
      Constructs a DateUtil object
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Boolean beforeToday​(java.util.Date date)
      Returns true if the date is before today
      boolean equals​(java.util.Date date1, java.util.Date date2)
      Returns true if two dates are equal
      int format​(java.util.Date date)  
      java.lang.String format​(java.util.Date date, java.lang.String pattern)
      Returns the date as a string in the format specified by the pattern
      java.util.Date getFirstDayOfWeek​(java.util.Date date)  
      java.util.Date getLastDayOfWeek​(java.util.Date date)
      Returns the date of the last day of the week.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DateUtil

        public DateUtil()
        Constructs a DateUtil object
    • Method Detail

      • equals

        public boolean equals​(java.util.Date date1,
                              java.util.Date date2)
        Returns true if two dates are equal
        Parameters:
        date1 - the first date
        date2 - the second date
        Returns:
        true if two dates are equal
      • getFirstDayOfWeek

        public java.util.Date getFirstDayOfWeek​(java.util.Date date)
      • getLastDayOfWeek

        public java.util.Date getLastDayOfWeek​(java.util.Date date)
        Returns the date of the last day of the week.
        Parameters:
        date - the date
        Returns:
        the date of the last day of the week
      • format

        public java.lang.String format​(java.util.Date date,
                                       java.lang.String pattern)
        Returns the date as a string in the format specified by the pattern
        Parameters:
        date - the date
        pattern - the pattern SimpleDateFormat
        Returns:
        the date as a string in the format specified by the pattern
      • format

        public int format​(java.util.Date date)
      • beforeToday

        public java.lang.Boolean beforeToday​(java.util.Date date)
        Returns true if the date is before today
        Parameters:
        date - the date
        Returns:
        true if the date is before today