0% found this document useful (0 votes)
42 views9 pages

Functions Jaspersoft

This document describes functions for manipulating dates and times in Java. It lists the name, description, return type, and parameters for over 30 date and time functions. These functions allow users to create and format dates, calculate differences between dates, extract date/time components, and check date properties. Common operations include generating dates from years/months/days, formatting dates as strings, and calculating durations between dates in various units.

Uploaded by

chino2889
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views9 pages

Functions Jaspersoft

This document describes functions for manipulating dates and times in Java. It lists the name, description, return type, and parameters for over 30 date and time functions. These functions allow users to create and format dates, calculate differences between dates, extract date/time components, and check date properties. Common operations include generating dates from years/months/days, formatting dates as strings, and calculating durations between dates in various units.

Uploaded by

chino2889
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Functions Sample

Date & Time - Category for date and time manipulation functions

Name  Description Return Type Parameters

Name Description Type Requir.

DATE Creates a date object using the specified information on java.util.Date Year The year of the new date java.lang.Integer Y
day, month and year.
Month The month of the new date java.lang.Integer Y

Day of month The day of the new date java.lang.Integer Y

DATEFORMAT Format the specified date object using the chosen format java.lang.String Selected date The date to format java.util.Date Y
pattern.
Format pattern Format pattern to apply when printing the date java.lang.String Y

DATERANGE Allows to create a JasperReports DateRange instance net.sf.jasperreports.types.d Date range details The date range information java.lang.Object Y
starting from either a String expression or a Date instance. ate.DateRange

DATEVALUE Gives the corresponding numeric value (long milliseconds) java.lang.Long Date object The object representing the date java.lang.Object Y
for a specified date object.
DAY Returns the day of a given date. Date object can be a java.lang.Integer Selected date The object representing the date java.lang.Object Y
String, long value (milliseconds) or Date instance itself.

DAYS Returns the number of days between two dates. java.lang.Integer Start date The initial date java.lang.Object Y

End date The end date java.lang.Object Y

DAYSINMONTH Returns the number of days in a month. java.lang.Integer Selected date The date to check java.lang.Object Y

DAYSINYEAR Returns the number of days in a year. java.lang.Integer Selected date The date to check java.lang.Object Y

EDATE Returns a date a number of months away. java.util.Date Selected date The object representing the date java.lang.Object Y

Months The number of months after the given date java.lang.Integer Y

HOUR Returns the hour (0-23) of the day for a given date. Date java.lang.Integer Selected date The object representing the date java.lang.Object Y
object can be a String, long value (milliseconds) or Date
instance itself.
ISLEAPYEAR Checks if the given date occurs in a leap year. java.lang.Boolean Selected date The date to check java.lang.Object Y

MINUTE Returns the minute (0-59) of the hour for a given date. java.lang.Integer Selected date The object representing the date java.lang.Object Y
Date object can be a String, long value (milliseconds) or
Date instance itself.
MONTH Returns the month of a given date. Date object can be a java.lang.Integer Selected date The object representing the date java.lang.Object Y
String, long value (milliseconds) or Date instance itself.

Page 1 of 9
Date & Time - Category for date and time manipulation functions

Name  Description Return Type Parameters

Name Description Type Requir.

MONTHS Returns the number of months between two dates. java.lang.Integer Start date The initial date java.lang.Object Y

End date The end date java.lang.Object Y

NETWORKDAYS Returns the number of working days between two dates java.lang.Integer Start date The initial date java.lang.Object Y
(inclusive). Saturday and Sunday are not considered
working days. End date The end date java.lang.Object Y

NOW Returns the current instant as date object java.util.Date

SECOND Returns the second (0-59) of the minute for a given date. java.lang.Integer Selected date The object representing the date java.lang.Object Y
Date object can be a String, long value (milliseconds) or
Date instance itself.
TIME Returns a text string representing a time value (hours, java.lang.String Hours The hours for the new time value java.lang.Integer Y
seconds and minutes). If no specific pattern is provided a
default formatter is used. Minutes The minutes for the new time value java.lang.Integer Y

Seconds The seconds for the new time value java.lang.Integer Y

Format pattern The pattern to format the time value java.lang.String

TODAY Returns the current date as date object java.util.Date

WEEKDAY Returns the day of the week for a given date. Date object java.lang.Integer Selected date The object representing the date java.lang.Object Y
can be a String, long value (milliseconds) or Date instance
itself. Sunday is first day Boolean flag to decide if Sunday should be considered java.lang.Boolean
as first day. Default is not
WEEKNUM Returns the week number of a given date. java.lang.Integer Selected date The date to check java.lang.Object Y

WEEKS Returns the number of weeks between two dates. java.lang.Integer Start date The initial date java.lang.Object Y

End date The end date java.lang.Object Y

WEEKSINYEAR Returns the number of weeks in a year. java.lang.Integer Selected date The date to check java.lang.Object Y

WORKDAY Returns a date a number of workdays away. Saturday and java.util.Date Selected date The object representing the date java.lang.Object Y
Sundays are not considered working days.
Working days The number of days after the given date java.lang.Integer Y

YEAR Returns the year of a given date. Date object can be a java.lang.Integer Selected date The object representing the date java.lang.Object Y
String, long value (milliseconds) or Date instance itself.

YEARS Returns the number of years between two dates. java.lang.Integer Start date The initial date java.lang.Object Y

End date The end date java.lang.Object Y

Page 2 of 9
Logical - Category for logical operations functions

Name  Description Return Type Parameters

Name Description Type Requir.

AND Returns true if all arguments are considered true, false java.lang.Boolean Argument A boolean expression or value [Ljava.lang.Boolean; Y
otherwise.
EQUALS Checks if the two specified objects are equal. java.lang.Boolean Object 1 The first element to be compared java.lang.Object Y

Object 2 The second element to be compared java.lang.Object Y

FALSE Returns the logical value FALSE. java.lang.Boolean

IF Returns one of two values, depending on a test condition. java.lang.Object Test condition An expression returning a boolean value java.lang.Boolean Y

Value 1 (true) The value returned when the test is true java.lang.Object Y

Value 2 (false) The value returned when the test is false java.lang.Object Y

NOT Returns the negation of the specified boolean expression. java.lang.Boolean Argument A boolean expression or value java.lang.Boolean Y

OR Returns true if any of the arguments is considered true, java.lang.Boolean Argument A boolean expression or value [Ljava.lang.Boolean; Y
false otherwise.
TRUE Returns the logical value TRUE. java.lang.Boolean

Page 3 of 9
Numeric / Mathematical - Category for mathematical operations functions

Name  Description Return Type Parameters

Name Description Type Requir.

ABS Returns the absolute value of a number. java.lang.Number Number The number to check java.lang.Number Y

CEIL Returns the smallest value that is greater than or equal to java.lang.Double Number Value java.lang.Number Y
the argument and is equal to a mathematical integer.

FACT Returns the factorial of a number. java.lang.Long Integer number The argument java.lang.Integer Y

FLOOR Returns the largest value that is less than or equal to the java.lang.Double Number Value java.lang.Number Y
argument and is equal to a mathematical integer.

ISEVEN Checks if a number is even. If a non-integer number is java.lang.Boolean Number The number to check java.lang.Number Y
specified, any digits after the decimal point are ignored.

ISODD Checks if a number is odd. If a non-integer number is java.lang.Boolean Number The number to check java.lang.Number Y
specified, any digits after the decimal point are ignored.

MAX Returns the maximum of a list of numeric values. java.lang.Number Number Number to compare [Ljava.lang.Number; Y

MIN Returns the minimum of a list of numeric values. java.lang.Number Number Number to compare [Ljava.lang.Number; Y

PRODUCT Returns the product of a list of numbers. java.lang.Number Number Argument [Ljava.lang.Number; Y

RAND Returns a random number between 0.0 and 1.0. java.lang.Double

RANDBETWEEN Returns an Integer random number between bottom and java.lang.Integer Bottom range Integer number for the bottom range java.lang.Integer Y
top range (both inclusive).
Top range Integer number for the top range java.lang.Integer Y

SIGN Returns the sign of a number. java.lang.Integer Number The number to check java.lang.Number Y

SQRT Returns the positive square root of a number. The number java.lang.Number Positive number Argument java.lang.Number Y
must be positive.
SUM Returns the sum of a list of numbers. java.lang.Number Number Addendum [Ljava.lang.Number; Y

Page 4 of 9
Text - Category for text/string manipulation functions

Name  Description Return Type Parameters

Name Description Type Requir.

BASE Returns a text representation of a number, in a specified java.lang.String Number The positive integer number to convert java.lang.Integer Y
base radix.
Radix The base radix, an integer between 2 and 36 java.lang.Integer Y

Minimum length java.lang.Integer

CHAR Returns a single text character, given a character code. java.lang.String Char code The character code, in the range 1-255 java.lang.Integer Y

CLEAN Returns a new text string without non-printable characters. java.lang.String Text The text to be cleaned java.lang.String Y

CODE Returns the numeric code (0-255) for the first character in java.lang.Integer Text The string containing the character to convert java.lang.String Y
a string.
CONCATENATE Combines a list of strings into a single one. java.lang.String Text Argument [Ljava.lang.String; Y

DOUBLE_VALUE Returns a Double number representing the given text java.lang.Double Number (as text) The input text string representing a number java.lang.String Y
string.
EXACT Returns TRUE if the two text specified are exactly the java.lang.Boolean Text 1 The first text to compare java.lang.String Y
same (case sensitive compare).
Text 2 The second text to compare java.lang.String Y

FIND Returns the character position of a string inside another java.lang.Integer Find text The text to look into java.lang.String Y
text. If the text is not found then -1 is returned.
Text to search The text string to search java.lang.String Y

Start position The position from which the search should start java.lang.Integer

FIXED Returns the text representing number with the specified java.lang.String Number The number to print out java.lang.Number Y
decimal places.
Decimals The number of decimal places java.lang.Integer Y

Omit separators The flag to specify if the thousands separators should java.lang.Boolean
be included or not
FLOAT_VALUE Returns a Float number representing the given text string. java.lang.Float Number (as text) The input text string representing a number java.lang.String Y

INTEGER_VALUE Returns an Integer number representing the given text java.lang.Integer Number (as text) The input text string representing a number java.lang.String Y
string.
LEFT Returns the specified number of characters (1 by default) java.lang.String Text The input text java.lang.String Y
from the left side of the input text.
Characters num The number of characters. Default (not specified) is 1 java.lang.Integer

LEN Returns the length of the specified text string. java.lang.Integer Text The input text string java.lang.String Y

LONG_VALUE Returns a Long number representing the given text string. java.lang.Long Number (as text) The input text string representing a number java.lang.String Y

Page 5 of 9
Text - Category for text/string manipulation functions

Name  Description Return Type Parameters

Name Description Type Requir.

LOWER Performs the lower case conversion of the specified text java.lang.String Text The input text string java.lang.String Y
string.
LTRIM Clear a string, removing leading whitespaces. java.lang.String Text The text string to be trimmed java.lang.String Y

MID Returns the text from the middle of a text string. java.lang.String Text The input text java.lang.String Y

Start The initial position to extract the text java.lang.Integer Y

Characters num The number of characters java.lang.Integer

PROPER Capitalizes each words of the specified text. The remaining java.lang.String Text The input text java.lang.String Y
parts of words are in lowercase.
REPLACE Replaces parts of a text string with a different one. Starting java.lang.String Original Text The input text to modify java.lang.String Y
from a specified position, removes a certain number of
characters and then insert the new text. Start position The number of characters. Default (not specified) is 1 java.lang.Integer Y

Characters num The number of characters to remove java.lang.Integer Y

New Text The text that will replace the old one java.lang.String Y

REPT Replicates an input text string for a specified number of java.lang.String Original Text The input text to replicate java.lang.String Y
times.
Number of copies The needed number of copies java.lang.Integer Y

RIGHT Returns the specified number of characters (1 by default) java.lang.String Text The input text java.lang.String Y
from the right side of the input text.
Characters num The number of characters. Default (not specified) is 1 java.lang.Integer

RTRIM Clear a string, removing trailing whitespaces. java.lang.String Text The text string to be trimmed java.lang.String Y

SEARCH Returns the position of a string of text in another string. java.lang.Integer Find Text The text to find java.lang.String Y
Search is not case-sensitive.
Text to search The text to look into java.lang.String Y

Start position The initial position java.lang.Integer

SUBSTITUTE Substitutes new text for old text in a text string. When no java.lang.String Original Text The text to be modified java.lang.String Y
occurrence is specified all occurrences are replaced.
Old Text The old text to be replaced java.lang.String Y

New Text The new text that will replace the old one java.lang.String Y

Occurrence The occurrence of old text to be replaced java.lang.Integer

T Returns the text string if the value is a string, otherwise an java.lang.String Generic value The object value to be tested java.lang.Object Y
empty string is returned.
Page 6 of 9
Text - Category for text/string manipulation functions

Name  Description Return Type Parameters

Name Description Type Requir.

TEXT Converts a number into a text string according to a java.lang.String Number The number to be formatted java.lang.Number Y
specified format.
Format The format pattern java.lang.String Y

TRIM Clear a string,removing leading and trailing whitespaces. java.lang.String Text The text string to be trimmed java.lang.String Y

UPPER Performs the upper case conversion of the specified text java.lang.String Text The input text string java.lang.String Y
string.

Functions Examples

Numeric / Mathematical Functions Expression Result

| -245 | is even ISEVEN(ABS(-245)) false

14.4 * 22.56 * 10 * 34 PRODUCT(14.4, 22.56, 10, 34) 110.453,76

Random number between 0 and 1000 1000 * RAND() 171,592

Factorial of 5 FACT(5) 120

SQRT(6.25) SQRT(6.25) 2,50

Max value in [4,6,2,3,9,4,1,7,3,8] MAX(4, 6, 2, 3, 9, 4, 1, 7, 3, 8) 9

Page 7 of 9
Date & Time Functions Expression Result

Current date DATEFORMAT(NOW(), "EEEE, MMM d, yyyy") luni, Mai 25, 2015

Current year YEAR(TODAY()) 2015

Four months later DATEFORMAT(EDATE(TODAY(), 4), "MM/dd/yyyy") 09/25/2015

Five years ago DATEFORMAT(EDATE(TODAY(), -60), "MMMM d, yyyy") mai 25, 2010

Current week number WEEKNUM(TODAY()) 22

Next working day DATEFORMAT(WORKDAY(TODAY(),1), "EEE, MMM dd") Ma, Mai 26

Years since 2000 YEARS(DATE(2000, 1, 1), NOW()) 15

Current time DATEFORMAT(TODAY(), "hh:mm:ss a") 03:54:47 PM

Text Functions Expression Result

Concatenate "Hello", " ", "World" CONCATENATE("Hello", " ", "World") Hello World

Case sensitive search for "ll' in "Hello" "Found on position " + (FIND("Hello", "ll") + 1) Found on position 3

Case insensitive search for "LL" in "all" "Found on position " + (SEARCH("LL", "all") + 1) Found on position 2

Lower case for "Hello WORLD" LOWER("Hello WORLD") hello world

Capitalize each word PROPER("Capitalize each word") Capitalize Each Word

Replicates "Hello " three times REPT("Hello ", 3) Hello Hello Hello

Substitute "o" by "0" in "Hello World" SUBSTITUTE("Hello World", "o", "0") Hell0 W0rld

Extract "orl" from "Hello World" MID("Hello World", 8, 3) orl

Page 8 of 9
Logical Functions Expression Result

This is true. TRUE() true

This is false. FALSE() false

3 < 5 AND 3 > 7 AND(3 < 5, 3 > 7) false

3 < 5 OR 3 > 7 OR(3 < 5, 3 > 7) true

Current month is before July IF(MONTH(TODAY()) < 7, "YES", "NO") YES

Page 9 of 9

You might also like