Class FlexDateTimeUtils

java.lang.Object
flexagon.ff.common.core.utils.FlexDateTimeUtils

public class FlexDateTimeUtils extends Object
Conversion and formatting helper methods.
  • Constructor Details

    • FlexDateTimeUtils

      public FlexDateTimeUtils()
  • Method Details

    • currentUtilDate

      public static Date currentUtilDate()
    • inFuture

      public static boolean inFuture(Date pDate)
    • inPast

      public static boolean inPast(Date pDate)
    • getValue

      public static int getValue(Date pDate, FlexDateTimeUtils.DateTimeComponent pType, TimeZone pTimeZone)
      get value using GregorianCalendar.
      Returns:
      value
    • addValue

      public static void addValue(Date pDate, FlexDateTimeUtils.DateTimeComponent pType, int pAmount, TimeZone pTimeZone)
      add value using GregorianCalendar.
    • setValue

      public static void setValue(Date pDate, FlexDateTimeUtils.DateTimeComponent pType, int pValue, TimeZone pTimeZone)
      Set value using GregorianCalendar.
    • toXMLGregorianCalendar

      public static XMLGregorianCalendar toXMLGregorianCalendar(Date pDate)
      util date to XML gregorian calendar
    • toUtilDate

      public static Date toUtilDate(XMLGregorianCalendar pXCal)
      xml gregorian calendar to util date
    • currentXMLGregorianCalendar

      public static XMLGregorianCalendar currentXMLGregorianCalendar()
    • dateToString

      public static String dateToString(XMLGregorianCalendar pXCal, String pFormat, TimeZone pTimeZone)
    • dateToString

      public static String dateToString(Date pDate, String pFormat, TimeZone pTimeZone)
      Date to string conversion must use Timezone.
    • stringToDate

      public static Date stringToDate(String pDate, String pFormat, TimeZone pTimeZone)
      supplied timezone must be for provided String representation of date.
    • stringToCalendar

      public static Calendar stringToCalendar(String pDate, String pFormat, TimeZone pTimeZone)
    • calendarToString

      public static String calendarToString(Calendar pCal, String pFormat)
    • diff

      public static long diff(Date pFirstDate, Date pSecondDate, TimeUnit pTimeUnit)
      Difference in specified TimeUnit.
      Returns:
      difference
    • getYear

      public static int getYear(Date pDate, TimeZone pTimeZone)
    • addYears

      public static void addYears(Date pDate, int pYears, TimeZone pTimeZone)
    • setYear

      public static void setYear(Date pDate, int pValue, TimeZone pTimeZone)
    • getMonth

      public static FlexDateTimeUtils.Month getMonth(Date pDate, TimeZone pTimeZone)
    • addMonths

      public static void addMonths(Date pDate, int pMonths, TimeZone pTimeZone)
    • setMonth

      public static void setMonth(Date pDate, FlexDateTimeUtils.Month pValue, TimeZone pTimeZone)
    • getDate

      public static int getDate(Date pDate, TimeZone pTimeZone)
    • setDate

      public static void setDate(Date pDate, int pValue, TimeZone pTimeZone)
    • getDayOfWeek

      public static FlexDateTimeUtils.Day getDayOfWeek(Date pDate, TimeZone pTimeZone)
    • addDays

      public static void addDays(Date pDate, int pDays, TimeZone pTimeZone)
    • getWeekOfMonth

      public static int getWeekOfMonth(Date pDate, TimeZone pTimeZone)
    • addWeeks

      public static void addWeeks(Date pDate, int pWeeks, TimeZone pTimeZone)
    • getHour24

      public static int getHour24(Date pDate, TimeZone pTimeZone)
    • getHour12

      public static int getHour12(Date pDate, TimeZone pTimeZone)
    • addHours

      public static void addHours(Date pDate, int pHours, TimeZone pTimeZone)
    • setHour24

      public static void setHour24(Date pDate, int pValue, TimeZone pTimeZone)
    • setHour12

      public static void setHour12(Date pDate, int pValue, TimeZone pTimeZone)
    • getMinutes

      public static int getMinutes(Date pDate, TimeZone pTimeZone)
    • addMinutes

      public static void addMinutes(Date pDate, int pMinutes, TimeZone pTimeZone)
    • setMinute

      public static void setMinute(Date pDate, int pValue, TimeZone pTimeZone)
    • addMilliSeconds

      public static void addMilliSeconds(Date pDate, int pMilliSec, TimeZone pTimeZone)