Class IlrDateUtil


  • public class IlrDateUtil
    extends Object
    A class proposing utility methods to handle Date/Time related types.
    Since:
    JRules 5.0
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int extractDayOfWeek​(Date date)
      Helper to get the day of week from a java.util.Date.
      static int extractMonth​(Date date)
      Helper to get a month from a date object.
      static int extractYear​(Date date)
      Helper to get the year from a date object.
      static Date getDate​(Date date)
      Helper to get the Date fields (every fields but the time-related fields) from a date object.
      static Date getDateFromDayOfWeek​(int dayOfWeek)
      Helper to get a java.util.Date from a day of week value.
      static Date getDateFromMonth​(int month)
      Helper to get a java.util.Date from a month value.
      static Date getDateFromYear​(int year)
      Helper to get a java.util.Date from a year value.
      static Date getDayOfWeek​(Date date)
      Helper to extract the day of week from date value, as a date.
      static long getLocalTime​(int year, int month, int date, int hour, int minute, int second, int millisecond)  
      static long getLocalTime​(int year, int month, int date, int hour, int minute, int second, int millisecond, int am_pm)
      Helper to get a time in milliseconds, expressed for the current time zone, from year, month, date, hour, minute, seconds and milliseconds.
      static Date getMonth​(Date date)
      Helper to extract the month from date value, as a date.
      static Date getTime​(Date date)
      Helper to get the time fields from a date object.
      static Date getYear​(Date date)
      Helper to extract the year from date value, as a date.
    • Method Detail

      • extractDayOfWeek

        public static int extractDayOfWeek​(Date date)
        Helper to get the day of week from a java.util.Date. It is used in translations of some methods on BOM class "java.util.Date".
      • getDate

        public static Date getDate​(Date date)
        Helper to get the Date fields (every fields but the time-related fields) from a date object.
      • getTime

        public static Date getTime​(Date date)
        Helper to get the time fields from a date object.
      • extractYear

        public static int extractYear​(Date date)
        Helper to get the year from a date object.
      • extractMonth

        public static int extractMonth​(Date date)
        Helper to get a month from a date object.
      • getDateFromYear

        public static Date getDateFromYear​(int year)
        Helper to get a java.util.Date from a year value.
      • getDateFromMonth

        public static Date getDateFromMonth​(int month)
        Helper to get a java.util.Date from a month value.
      • getDateFromDayOfWeek

        public static Date getDateFromDayOfWeek​(int dayOfWeek)
        Helper to get a java.util.Date from a day of week value.
      • getYear

        public static Date getYear​(Date date)
        Helper to extract the year from date value, as a date.
        Parameters:
        date - the date containing the desired year value
      • getDayOfWeek

        public static Date getDayOfWeek​(Date date)
        Helper to extract the day of week from date value, as a date.
        Parameters:
        date - the date containing the desired day of week value
      • getMonth

        public static Date getMonth​(Date date)
        Helper to extract the month from date value, as a date.
        Parameters:
        date - the date containing the desired month value
      • getLocalTime

        public static long getLocalTime​(int year,
                                        int month,
                                        int date,
                                        int hour,
                                        int minute,
                                        int second,
                                        int millisecond,
                                        int am_pm)
        Helper to get a time in milliseconds, expressed for the current time zone, from year, month, date, hour, minute, seconds and milliseconds. This static method uses a calendar to create the long value. It adds a millisecond precision to the usual GregorianCalendar constructor.
        Parameters:
        year - The value used to set the YEAR time field in the calendar.
        month - The value used to set the MONTH time field in the calendar. Month value is 0-based. e.g., 0 for January.
        date - The value used to set the DATE time field in the calendar.
        hour - The value used to set the HOUR_OF_DAY time field in the calendar.
        minute - The value used to set the MINUTE time field in the calendar.
        second - The value used to set the SECOND time field in the calendar.
        millisecond - The value used to set the MILLISECOND time field in the calendar.
        am_pm - The value to used to set the AM_PM time field in the calendar.
      • getLocalTime

        public static long getLocalTime​(int year,
                                        int month,
                                        int date,
                                        int hour,
                                        int minute,
                                        int second,
                                        int millisecond)