Class DateTimeFunctions
- java.lang.Object
-
- net.sf.jasperreports.functions.AbstractFunctionSupport
-
- net.sf.jasperreports.functions.standard.DateTimeFunctions
-
- All Implemented Interfaces:
net.sf.jasperreports.functions.FunctionSupport
public final class DateTimeFunctions extends net.sf.jasperreports.functions.AbstractFunctionSupportThis class should maintain all function methods that belongs to the DateTime category.- Author:
- Massimo Rabbi (mrabbi@users.sourceforge.net)
-
-
Constructor Summary
Constructors Constructor Description DateTimeFunctions()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DateDATE(Integer year, Integer month, Integer dayOfMonth)Creates a date object using the specified information on day, month and year.StringDATEFORMAT(Date dateObj, String formatPattern)Format the specified date object using the chosen format pattern.net.sf.jasperreports.types.date.DateRangeDATERANGE(Object dateExprObj)Allows to create a JasperReports DateRange instance starting from either a String expression or a Date instance.LongDATEVALUE(Object dateObject)Gives the corresponding numeric value (long milliseconds) for a specified date object.IntegerDAY(Object dateObject)Returns the day of a given date.IntegerDAYS(Object startDate, Object endDate)Returns the number of days between two dates.IntegerDAYSINMONTH(Object dateObj)Returns the number of days in a month.IntegerDAYSINYEAR(Object dateObj)Returns the number of days in a year.DateEDATE(Object dateObject, Integer months)Returns a date a number of months away.IntegerHOUR(Object dateObject)Returns the hour (0-23) of the day for a given date.BooleanISLEAPYEAR(Object dateObj)Checks if the given date occurs in a leap year.IntegerMINUTE(Object dateObject)Returns the minute (0-59) of the hour for a given date.IntegerMONTH(Object dateObject)Returns the month of a given date.IntegerMONTHS(Object startDate, Object endDate)Returns the number of months between two dates.IntegerNETWORKDAYS(Object startDate, Object endDate)Returns the number of working days between two dates (inclusive).DateNOW()Returns the current instant as date object.IntegerSECOND(Object dateObject)Returns the second (0-59) of the minute for a given date.StringTIME(Integer hours, Integer minutes, Integer seconds)Returns a text string representing a time value (hours, seconds and minutes).StringTIME(Integer hours, Integer minutes, Integer seconds, String timePattern)DateTODAY()Returns the current date as date object.IntegerWEEKDAY(Object dateObject)Returns the day of the week for a given date.IntegerWEEKDAY(Object dateObject, Boolean isSundayFirstDay)IntegerWEEKNUM(Object dateObj)Returns the week number of a given date.IntegerWEEKS(Object startDate, Object endDate)Returns the number of weeks between two dates.IntegerWEEKSINYEAR(Object dateObj)Returns the number of weeks in a year.DateWORKDAY(Object dateObject, Integer workdays)Returns a date a number of workdays away.IntegerYEAR(Object dateObject)Returns the year of a given date.IntegerYEARS(Object startDate, Object endDate)Returns the number of years between two dates.
-
-
-
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.
-
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.
-
WEEKS
public Integer WEEKS(Object startDate, Object endDate)
Returns the number of weeks between two dates.
-
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 net.sf.jasperreports.types.date.DateRange DATERANGE(Object dateExprObj)
Allows to create a JasperReports DateRange instance starting from either a String expression or a Date instance.
-
-