Class DateTimeFunctions

  • All Implemented Interfaces:
    FunctionSupport

    public final class DateTimeFunctions
    extends AbstractFunctionSupport
    This class should maintain all function methods that belongs to the DateTime category.
    Author:
    Massimo Rabbi (mrabbi@users.sourceforge.net)
    • Constructor Detail

      • DateTimeFunctions

        public DateTimeFunctions()
    • Method Detail

      • TODAY

        public Date TODAY()
        Returns the current date as date object.
      • NOW

        public Date NOW()
        Returns the current instant as date object.
      • YEAR

        public Integer YEAR​(Object dateObject)
        Returns the year of a given date. Date object can be a String, long value (milliseconds) or Date instance itself.
      • MONTH

        public Integer MONTH​(Object dateObject)
        Returns the month of a given date. Date object can be a String, long value (milliseconds) or Date instance itself.
      • DAY

        public Integer DAY​(Object dateObject)
        Returns the day of a given date. Date object can be a String, long value (milliseconds) or Date instance itself.
      • WEEKDAY

        public Integer WEEKDAY​(Object dateObject)
        Returns the day of the week for a given date. Date object can be a String, long value (milliseconds) or Date instance itself.
      • HOUR

        public Integer HOUR​(Object dateObject)
        Returns the hour (0-23) of the day for a given date. Date object can be a String, long value (milliseconds) or Date instance itself.
      • MINUTE

        public Integer MINUTE​(Object dateObject)
        Returns the minute (0-59) of the hour for a given date. Date object can be a String, long value (milliseconds) or Date instance itself.
      • SECOND

        public Integer SECOND​(Object dateObject)
        Returns the second (0-59) of the minute for a given date. Date object can be a String, long value (milliseconds) or Date instance itself.
      • DATE

        public Date DATE​(Integer year,
                         Integer month,
                         Integer dayOfMonth)
        Creates a date object using the specified information on day, month and year.
      • DATEVALUE

        public Long DATEVALUE​(Object dateObject)
        Gives the corresponding numeric value (long milliseconds) for a specified date object.
      • TIME

        public String TIME​(Integer hours,
                           Integer minutes,
                           Integer seconds)
        Returns a text string representing a time value (hours, seconds and minutes). If no specific pattern is specified a default formatter is used.
      • EDATE

        public Date EDATE​(Object dateObject,
                          Integer months)
        Returns a date a number of months away.
      • WORKDAY

        public Date WORKDAY​(Object dateObject,
                            Integer workdays)
        Returns a date a number of workdays away. Saturday and Sundays are not considered working days.
      • NETWORKDAYS

        public Integer NETWORKDAYS​(Object startDate,
                                   Object endDate)
        Returns the number of working days between two dates (inclusive). Saturday and Sunday are not considered working days.
      • DAYS

        public Integer DAYS​(Object startDate,
                            Object endDate)
        Returns the number of days between two dates.
      • DAYSINMONTH

        public Integer DAYSINMONTH​(Object dateObj)
        Returns the number of days in a month.
      • DAYSINYEAR

        public Integer DAYSINYEAR​(Object dateObj)
        Returns the number of days in a year.
      • WEEKS

        public Integer WEEKS​(Object startDate,
                             Object endDate)
        Returns the number of weeks between two dates.
      • WEEKSINYEAR

        public Integer WEEKSINYEAR​(Object dateObj)
        Returns the number of weeks in a year.
      • WEEKNUM

        public Integer WEEKNUM​(Object dateObj)
        Returns the week number of a given date.
      • MONTHS

        public Integer MONTHS​(Object startDate,
                              Object endDate)
        Returns the number of months between two dates.
      • YEARS

        public Integer YEARS​(Object startDate,
                             Object endDate)
        Returns the number of years between two dates.
      • ISLEAPYEAR

        public Boolean ISLEAPYEAR​(Object dateObj)
        Checks if the given date occurs in a leap year.
      • DATEFORMAT

        public String DATEFORMAT​(Date dateObj,
                                 String formatPattern)
        Format the specified date object using the chosen format pattern.
      • DATERANGE

        public DateRange DATERANGE​(Object dateExprObj)
        Allows to create a JasperReports DateRange instance starting from either a String expression or a Date instance.