Class DateTimeFunctions
- java.lang.Object
-
- net.sf.jasperreports.functions.AbstractFunctionSupport
-
- net.sf.jasperreports.functions.standard.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 Summary
Constructors Constructor Description DateTimeFunctions()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Date
DATE(Integer year, Integer month, Integer dayOfMonth)
Creates a date object using the specified information on day, month and year.String
DATEFORMAT(Date dateObj, String formatPattern)
Format the specified date object using the chosen format pattern.DateRange
DATERANGE(Object dateExprObj)
Allows to create a JasperReports DateRange instance starting from either a String expression or a Date instance.Long
DATEVALUE(Object dateObject)
Gives the corresponding numeric value (long milliseconds) for a specified date object.Integer
DAY(Object dateObject)
Returns the day of a given date.Integer
DAYS(Object startDate, Object endDate)
Returns the number of days between two dates.Integer
DAYSINMONTH(Object dateObj)
Returns the number of days in a month.Integer
DAYSINYEAR(Object dateObj)
Returns the number of days in a year.Date
EDATE(Object dateObject, Integer months)
Returns a date a number of months away.Integer
HOUR(Object dateObject)
Returns the hour (0-23) of the day for a given date.Boolean
ISLEAPYEAR(Object dateObj)
Checks if the given date occurs in a leap year.Integer
MINUTE(Object dateObject)
Returns the minute (0-59) of the hour for a given date.Integer
MONTH(Object dateObject)
Returns the month of a given date.Integer
MONTHS(Object startDate, Object endDate)
Returns the number of months between two dates.Integer
NETWORKDAYS(Object startDate, Object endDate)
Returns the number of working days between two dates (inclusive).Date
NOW()
Returns the current instant as date object.Integer
SECOND(Object dateObject)
Returns the second (0-59) of the minute for a given date.String
TIME(Integer hours, Integer minutes, Integer seconds)
Returns a text string representing a time value (hours, seconds and minutes).String
TIME(Integer hours, Integer minutes, Integer seconds, String timePattern)
Date
TODAY()
Returns the current date as date object.Integer
WEEKDAY(Object dateObject)
Returns the day of the week for a given date.Integer
WEEKDAY(Object dateObject, Boolean isSundayFirstDay)
Integer
WEEKNUM(Object dateObj)
Returns the week number of a given date.Integer
WEEKS(Object startDate, Object endDate)
Returns the number of weeks between two dates.Integer
WEEKSINYEAR(Object dateObj)
Returns the number of weeks in a year.Date
WORKDAY(Object dateObject, Integer workdays)
Returns a date a number of workdays away.Integer
YEAR(Object dateObject)
Returns the year of a given date.Integer
YEARS(Object startDate, Object endDate)
Returns the number of years between two dates.-
Methods inherited from class net.sf.jasperreports.functions.AbstractFunctionSupport
getContext, init
-
-
-
-
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.
-
-