Class DateUtil

java.lang.Object
com.isomorphic.util.date.DateUtil

public class DateUtil extends Object
A utility class with various methods for dealing with dates, calendars and time.
  • Method Details

    • getAbsoluteDate

      public static GregorianCalendar getAbsoluteDate(RelativeDate relativeDate, boolean isLogicalDate)
      Gets the absolute date for a relative date with the current date and time as the relevance point.
      Parameters:
      isLogicalDate - false if this date should include the time.
      Returns:
      a gregorian calendar.
    • getAbsoluteDate

      public static GregorianCalendar getAbsoluteDate(RelativeDate relativeDate, Date baseDate, boolean isLogicalDate)
      Gets the absolute date for a relative date with a base date and time as the relevance point.
      Parameters:
      baseDate - the relevance point to get the absolute date for.
      isLogicalDate - false if this date should include the time.
      Returns:
      a gregorian calendar.
    • isRelativeDate

      public static boolean isRelativeDate(Object value)
      Checks if a value, usually criteria value, is a relative date.
      Parameters:
      value - the value to check.
      Returns:
      true if the value is a relative date, otherwise false.
    • createLogicalDate

      public static GregorianCalendar createLogicalDate(int year, int month, int day)
      Creates a logical date for the year, month and day provided. This method will default the locale to the servers current locale.
      Parameters:
      year - the year, such as 1984.
      month - the month, a value between 0 and 11 inclusive where 0 is January.
      day - the day of the month, a value between 1 and 31 inclusive.
      Returns:
      a GregorianCalendar representing the logical date.
    • createLogicalDate

      public static GregorianCalendar createLogicalDate(int year, int month, int day, Locale locale)
      Creates a logical date for the locale, year, month and day provided.
      Parameters:
      year - the year, such as 1984.
      month - the month, a value between 0 and 11 inclusive where 0 is January.
      day - the day of the month, a value between 1 and 31 inclusive.
      locale - the locale or time zone of the date to create.
      Returns:
      a GregorianCalendar representing the logical date.
    • createLogicalDate

      public static GregorianCalendar createLogicalDate(long millisecondsTimeStamp)
      Creates a logical date for the locale and timestamp in milliseconds provided. This method will default the locale to the servers current locale.
      Parameters:
      millisecondsTimeStamp - the timestamp in UTC milliseconds from the epoch.
      Returns:
      a GregorianCalendar representing the logical date.
    • createLogicalDate

      public static GregorianCalendar createLogicalDate(long millisecondsTimeStamp, Locale locale)
      Creates a logical date for the locale and timestamp in milliseconds provided.
      Parameters:
      millisecondsTimeStamp - the timestamp in UTC milliseconds from the epoch.
      locale - the locale or time zone of the date to create.
      Returns:
      a GregorianCalendar representing the logical date.