public class DateFunctions extends Object
| Constructor and Description |
|---|
DateFunctions()
Creates new instance.
|
| Modifier and Type | Method and Description |
|---|---|
RecordHolder |
addDurations(ExecutionContext ctx,
RecordHolder duration1,
RecordHolder duration2)
Returns a duration obtained by adding the values of the corresponding fields of duration1 and duration2.
|
Date |
addDurationToDate(ExecutionContext ctx,
Date date,
RecordHolder duration)
Returns a date obtained by adding the duration to the date.
|
java.time.LocalDate |
addDurationToLocalDate(ExecutionContext ctx,
java.time.LocalDate date,
RecordHolder duration)
Returns a date equal to
date + duration. |
java.time.LocalDate |
currentDate(ExecutionContext ctx)
Returns the current date (today).
|
Date |
date(ExecutionContext ctx,
Decimal epochMillis)
Allocates a
Date object and initializes it to
represent the specified number of milliseconds since the
standard base time known as "the epoch", namely January 1,
1970, 00:00:00 GMT. |
Date |
date(ExecutionContext ctx,
Decimal year,
Decimal month,
Decimal dayOfMonth)
Creates a date from year, month of year, and dayOfMonth.
|
Date |
date(ExecutionContext ctx,
Decimal year,
Decimal month,
Decimal dayOfMonth,
Decimal hour,
Decimal minute,
Decimal second,
Decimal millis)
Creates a date from year, month of year, dayOfMonth, hour of day, minute of hour, second of
minute, and millisecond of second.
|
Date |
date(ExecutionContext ctx,
String string)
Tries to parse given string to
Date value |
Date |
date(ExecutionContext ctx,
String string,
String pattern)
Will parse date using passed pattern string and date string Must use patterns recognized by
SimpleDateFormat |
Date |
date(ExecutionContext ctx,
String string,
String pattern,
String locale)
Will parse date using passed pattern string and date string Must use patterns recognized by
SimpleDateFormat |
String |
format(ExecutionContext ctx,
java.time.LocalDate date,
String pattern)
Formats a given local date.
|
String |
formatDate(ExecutionContext ctx,
Date date,
String pattern,
String timeZone)
Returns a string created by formatting the date to the specified format.
|
String |
formatDate(ExecutionContext ctx,
Date date,
String pattern,
String timeZone,
String locale)
Returns a string created by formatting the date to the specified format.
|
Decimal |
getDayOfMonth(ExecutionContext ctx,
Date date)
Returns the day of a month of the date.
|
Decimal |
getDayOfMonth(ExecutionContext ctx,
java.time.LocalDate date)
Returns the day of a month of the date.
|
Decimal |
getDayOfWeek(ExecutionContext ctx,
Date date)
Returns the day of a week of the date.
|
Decimal |
getDayOfWeek(ExecutionContext ctx,
java.time.LocalDate date)
Returns the day of a week of the date.
|
Decimal |
getDayOfYear(ExecutionContext ctx,
Date date)
Returns the day of a year of the date.
|
Decimal |
getDayOfYear(ExecutionContext ctx,
java.time.LocalDate date)
Returns the day of a year of the date.
|
Decimal |
getEpochDay(ExecutionContext ctx,
java.time.LocalDate date)
Returns the epoch day.
|
Decimal |
getEpochMillis(ExecutionContext ctx,
Date date)
Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT
represented by this Date object.
|
Decimal |
getHour(ExecutionContext ctx,
Date date)
Returns the hour of a day of the date.
|
Decimal |
getMillis(ExecutionContext ctx,
Date date)
Returns the millisecond of a second of the date.
|
Decimal |
getMinute(ExecutionContext ctx,
Date date)
Returns the minute of an hour of the date.
|
Decimal |
getMonth(ExecutionContext ctx,
Date date)
Returns the month of a year of the date.
|
Decimal |
getMonth(ExecutionContext ctx,
java.time.LocalDate date)
Returns the month of a year of the date.
|
Decimal |
getSecond(ExecutionContext ctx,
Date date)
Returns the second of a minute of the date.
|
Decimal |
getWeek(ExecutionContext ctx,
Date date)
Returns the week of a year of the date.
|
Decimal |
getYear(ExecutionContext ctx,
Date date)
Returns the year of the date.
|
Decimal |
getYear(ExecutionContext ctx,
java.time.LocalDate date)
Returns the year of the date.
|
Decimal |
intervalInDays(ExecutionContext ctx,
Date date1,
Date date2)
Returns a number of days between two dates, date2 - date1.
|
Decimal |
intervalInHours(ExecutionContext ctx,
Date date1,
Date date2)
Returns a number of hours between two dates, date2 - date1.
|
Decimal |
intervalInMillis(ExecutionContext ctx,
Date date1,
Date date2)
Returns a number of milliseconds between two dates, date2 - date1.
|
Decimal |
intervalInMinutes(ExecutionContext ctx,
Date date1,
Date date2)
Returns a number of minutes between two dates, date2 - date1.
|
Decimal |
intervalInMonths(ExecutionContext ctx,
Date date1,
Date date2)
Returns a number of months between two dates, date2 - date1.
|
Decimal |
intervalInSeconds(ExecutionContext ctx,
Date date1,
Date date2)
Returns a number of seconds between two dates, date2 - date1.
|
Decimal |
intervalInWeeks(ExecutionContext ctx,
Date date1,
Date date2)
Returns a number of weeks between two dates, date2 - date1.
|
Decimal |
intervalInYears(ExecutionContext ctx,
Date date1,
Date date2)
Returns a number of years between two dates, date2 - date1.
|
java.time.LocalDate |
localDate(ExecutionContext ctx,
Decimal epochDay)
Returns an instance of
LocalDate from the epoch day count. |
java.time.LocalDate |
localDate(ExecutionContext ctx,
Decimal year,
Decimal month,
Decimal dayOfMonth)
Creates a local date.
|
java.time.LocalDate |
localDate(ExecutionContext ctx,
String string)
Parses a given local date.
|
Date |
max(Date... values)
Computes max Date from all passed dates
|
java.time.LocalDate |
max(ExecutionContext ctx,
java.time.LocalDate... dates) |
Date |
min(Date... values)
Computes minimal Date from all passed dates
|
java.time.LocalDate |
min(ExecutionContext ctx,
java.time.LocalDate... dates) |
RecordHolder |
multiplyDuration(ExecutionContext ctx,
RecordHolder duration,
Decimal number)
Returns a duration obtained by multiplying each field of the duration by the specified number and rounding the value down.
|
RecordHolder |
negateDuration(ExecutionContext ctx,
RecordHolder duration)
Returns a duration obtained by negating of each field of the specified duration.
|
Date |
now()
Uses
Date and returns current date and time |
Date |
setDate(ExecutionContext ctx,
Date date,
Decimal year,
Decimal month,
Decimal dayOfMonth)
Returns a copy of the date with the year, month, and dayOfMonth fields updated.
|
Date |
setDayOfMonth(ExecutionContext ctx,
Date date,
Decimal dayOfMonth)
Returns a copy of the date with the dayOfMonth field updated.
|
Date |
setDayOfWeek(ExecutionContext ctx,
Date date,
Decimal dayOfWeek)
Returns a copy of the date with the dayOfWeek field updated.
|
Date |
setDayOfYear(ExecutionContext ctx,
Date date,
Decimal dayOfYear)
Returns a copy of the date with the dayOfYear field updated.
|
Date |
setHour(ExecutionContext ctx,
Date date,
Decimal hour)
Returns a copy of the date with the hour (meaning hour of day) field updated.
|
Date |
setMillis(ExecutionContext ctx,
Date date,
Decimal millis)
Returns a copy of the date with the millis (meaning millisecond of second) field updated.
|
Date |
setMinute(ExecutionContext ctx,
Date date,
Decimal minute)
Returns a copy of the date with the minute (meaning minute of hour) field updated.
|
Date |
setMonth(ExecutionContext ctx,
Date date,
Decimal month)
Returns a copy of the date with the month field updated.
|
Date |
setSecond(ExecutionContext ctx,
Date date,
Decimal second)
Returns a copy of the date with the second (meaning second of minute) field updated.
|
Date |
setTime(ExecutionContext ctx,
Date date,
Decimal hour,
Decimal minute,
Decimal second,
Decimal millis)
Returns a copy of the date with the hour (meaning hour of day), minute (meaning minute of
hour), second (meaning second of minute), and millis (meaning millisecond of second) fields
updated.
|
Date |
setWeek(ExecutionContext ctx,
Date date,
Decimal week)
Returns a copy of the date with the week (meaning week of year) field updated.
|
Date |
setYear(ExecutionContext ctx,
Date date,
Decimal year)
Returns a copy of the date with the year field updated.
|
RecordHolder |
subtractDates(ExecutionContext ctx,
Date date1,
Date date2)
Returns a duration obtained by subtracting the date2 from the date1.
|
Date |
subtractDurationFromDate(ExecutionContext ctx,
Date date,
RecordHolder duration)
Returns a date obtained by subtracting the duration from the date.
|
java.time.LocalDate |
subtractDurationFromLocalDate(ExecutionContext ctx,
java.time.LocalDate date,
RecordHolder duration)
Returns a date equal to
date - duration. |
RecordHolder |
subtractDurations(ExecutionContext ctx,
RecordHolder duration1,
RecordHolder duration2)
Returns a duration obtained by subtracting each field of duration2 from the corresponding field of duration1.
|
RecordHolder |
subtractLocalDates(ExecutionContext ctx,
java.time.LocalDate date1,
java.time.LocalDate date2)
Returns a duration representing a duration between two dates.
|
Date |
toDate(ExecutionContext ctx,
java.time.LocalDate localDate)
Create an instance of
Date from the LocalDate instance (at start of day). |
Date |
today()
Computes current date without time Method will use default time zone of VM
|
java.time.LocalDate |
toLocalDate(ExecutionContext ctx,
Date date)
Create an instance of
LocalDate from the Date instance. |
public Date date(ExecutionContext ctx, Decimal epochMillis) throws ErrorException
Date object and initializes it to
represent the specified number of milliseconds since the
standard base time known as "the epoch", namely January 1,
1970, 00:00:00 GMT.ctx - epochMillis - ErrorExceptionpublic Decimal getEpochMillis(ExecutionContext ctx, Date date) throws ErrorException
ctx - date - ErrorExceptionpublic Date date(ExecutionContext ctx, String string) throws ErrorException
Date valuectx - string - ErrorExceptionpublic Date date(ExecutionContext ctx, String string, String pattern) throws ErrorException
SimpleDateFormatctx - string - pattern - ErrorExceptionpublic Date date(ExecutionContext ctx, String string, String pattern, String locale) throws ErrorException
SimpleDateFormatctx - string - pattern - locale - ErrorExceptionpublic Date today()
public Date min(Date... values)
values - public Date max(Date... values)
values - public Date addDurationToDate(ExecutionContext ctx, Date date, RecordHolder duration) throws ErrorException
ctx - date - duration - ErrorExceptionpublic Date subtractDurationFromDate(ExecutionContext ctx, Date date, RecordHolder duration) throws ErrorException
ctx - date - duration - ErrorExceptionpublic RecordHolder addDurations(ExecutionContext ctx, RecordHolder duration1, RecordHolder duration2) throws ErrorException
ctx - duration1 - duration2 - ErrorExceptionpublic RecordHolder subtractDurations(ExecutionContext ctx, RecordHolder duration1, RecordHolder duration2) throws ErrorException
ctx - duration1 - duration2 - ErrorExceptionpublic RecordHolder negateDuration(ExecutionContext ctx, RecordHolder duration) throws ErrorException
ctx - duration - ErrorExceptionpublic RecordHolder multiplyDuration(ExecutionContext ctx, RecordHolder duration, Decimal number) throws ErrorException
ctx - duration - number - ErrorExceptionpublic RecordHolder subtractDates(ExecutionContext ctx, Date date1, Date date2)
ctx - date1 - date2 - public Date date(ExecutionContext ctx, Decimal year, Decimal month, Decimal dayOfMonth, Decimal hour, Decimal minute, Decimal second, Decimal millis) throws ErrorException
ctx - year - month - dayOfMonth - hour - minute - second - millis - ErrorExceptionpublic Date date(ExecutionContext ctx, Decimal year, Decimal month, Decimal dayOfMonth) throws ErrorException
ctx - year - month - dayOfMonth - ErrorExceptionpublic Decimal getYear(ExecutionContext ctx, Date date) throws ErrorException
ctx - date - ErrorExceptionpublic Decimal getMonth(ExecutionContext ctx, Date date) throws ErrorException
ctx - date - ErrorExceptionpublic Decimal getWeek(ExecutionContext ctx, Date date) throws ErrorException
ctx - date - ErrorExceptionpublic Decimal getDayOfYear(ExecutionContext ctx, Date date) throws ErrorException
ctx - date - ErrorExceptionpublic Decimal getDayOfMonth(ExecutionContext ctx, Date date) throws ErrorException
ctx - date - ErrorExceptionpublic Decimal getDayOfWeek(ExecutionContext ctx, Date date) throws ErrorException
ctx - date - ErrorExceptionpublic Decimal getHour(ExecutionContext ctx, Date date) throws ErrorException
ctx - date - ErrorExceptionpublic Decimal getMinute(ExecutionContext ctx, Date date) throws ErrorException
ctx - date - ErrorExceptionpublic Decimal getSecond(ExecutionContext ctx, Date date) throws ErrorException
ctx - date - ErrorExceptionpublic Decimal getMillis(ExecutionContext ctx, Date date) throws ErrorException
ctx - date - ErrorExceptionpublic Decimal intervalInYears(ExecutionContext ctx, Date date1, Date date2) throws ErrorException
ctx - date1 - date2 - ErrorExceptionpublic Decimal intervalInMonths(ExecutionContext ctx, Date date1, Date date2) throws ErrorException
ctx - date1 - date2 - ErrorExceptionpublic Decimal intervalInWeeks(ExecutionContext ctx, Date date1, Date date2) throws ErrorException
ctx - date1 - date2 - ErrorExceptionpublic Decimal intervalInDays(ExecutionContext ctx, Date date1, Date date2) throws ErrorException
ctx - date1 - date2 - ErrorExceptionpublic Decimal intervalInHours(ExecutionContext ctx, Date date1, Date date2) throws ErrorException
ctx - date1 - date2 - ErrorExceptionpublic Decimal intervalInMinutes(ExecutionContext ctx, Date date1, Date date2) throws ErrorException
ctx - date1 - date2 - ErrorExceptionpublic Decimal intervalInSeconds(ExecutionContext ctx, Date date1, Date date2) throws ErrorException
ctx - date1 - date2 - ErrorExceptionpublic Decimal intervalInMillis(ExecutionContext ctx, Date date1, Date date2) throws ErrorException
ctx - date1 - date2 - ErrorExceptionpublic Date setYear(ExecutionContext ctx, Date date, Decimal year) throws ErrorException
ctx - date - year - ErrorExceptionpublic Date setMonth(ExecutionContext ctx, Date date, Decimal month) throws ErrorException
ctx - date - month - ErrorExceptionpublic Date setWeek(ExecutionContext ctx, Date date, Decimal week) throws ErrorException
ctx - date - week - ErrorExceptionpublic Date setDayOfYear(ExecutionContext ctx, Date date, Decimal dayOfYear) throws ErrorException
ctx - date - dayOfYear - ErrorExceptionpublic Date setDayOfMonth(ExecutionContext ctx, Date date, Decimal dayOfMonth) throws ErrorException
ctx - date - dayOfMonth - ErrorExceptionpublic Date setDayOfWeek(ExecutionContext ctx, Date date, Decimal dayOfWeek) throws ErrorException
ctx - date - dayOfWeek - ErrorExceptionpublic Date setHour(ExecutionContext ctx, Date date, Decimal hour) throws ErrorException
ctx - date - hour - ErrorExceptionpublic Date setMinute(ExecutionContext ctx, Date date, Decimal minute) throws ErrorException
ctx - date - minute - ErrorExceptionpublic Date setSecond(ExecutionContext ctx, Date date, Decimal second) throws ErrorException
ctx - date - second - ErrorExceptionpublic Date setMillis(ExecutionContext ctx, Date date, Decimal millis) throws ErrorException
ctx - date - millis - ErrorExceptionpublic Date setDate(ExecutionContext ctx, Date date, Decimal year, Decimal month, Decimal dayOfMonth) throws ErrorException
ctx - date - year - month - dayOfMonth - ErrorExceptionpublic Date setTime(ExecutionContext ctx, Date date, Decimal hour, Decimal minute, Decimal second, Decimal millis) throws ErrorException
ctx - date - hour - minute - second - millis - ErrorExceptionpublic String formatDate(ExecutionContext ctx, Date date, String pattern, String timeZone) throws ErrorException
ctx - pattern - date - timeZone - ErrorExceptionpublic String formatDate(ExecutionContext ctx, Date date, String pattern, String timeZone, String locale) throws ErrorException
ctx - pattern - date - timeZone - locale - a locale string, e.g. "en_US", may be null (the default locale is used)ErrorExceptionpublic java.time.LocalDate currentDate(ExecutionContext ctx)
ctx - public java.time.LocalDate localDate(ExecutionContext ctx, String string) throws ErrorException
ctx - string - ErrorExceptionpublic java.time.LocalDate localDate(ExecutionContext ctx, Decimal year, Decimal month, Decimal dayOfMonth) throws ErrorException
ctx - year - month - dayOfMonth - ErrorExceptionpublic java.time.LocalDate localDate(ExecutionContext ctx, Decimal epochDay) throws ErrorException
LocalDate from the epoch day count.ctx - epochDay - LocalDate from the epoch day countErrorExceptionpublic Decimal getEpochDay(ExecutionContext ctx, java.time.LocalDate date)
ctx - date - public Decimal getDayOfYear(ExecutionContext ctx, java.time.LocalDate date) throws ErrorException
ctx - date - ErrorExceptionpublic Decimal getDayOfMonth(ExecutionContext ctx, java.time.LocalDate date) throws ErrorException
ctx - date - ErrorExceptionpublic Decimal getDayOfWeek(ExecutionContext ctx, java.time.LocalDate date) throws ErrorException
ctx - date - ErrorExceptionpublic Decimal getMonth(ExecutionContext ctx, java.time.LocalDate date) throws ErrorException
ctx - date - ErrorExceptionpublic Decimal getYear(ExecutionContext ctx, java.time.LocalDate date) throws ErrorException
ctx - date - ErrorExceptionpublic java.time.LocalDate addDurationToLocalDate(ExecutionContext ctx, java.time.LocalDate date, RecordHolder duration) throws ErrorException
date + duration.ctx - date - duration - date + durationErrorExceptionpublic java.time.LocalDate subtractDurationFromLocalDate(ExecutionContext ctx, java.time.LocalDate date, RecordHolder duration) throws ErrorException
date - duration.ctx - date - duration - date - duration.ErrorExceptionpublic RecordHolder subtractLocalDates(ExecutionContext ctx, java.time.LocalDate date1, java.time.LocalDate date2) throws ErrorException
ctx - date1 - date2 - ErrorExceptionpublic java.time.LocalDate toLocalDate(ExecutionContext ctx, Date date)
LocalDate from the Date instance.ctx - date - LocalDatepublic Date toDate(ExecutionContext ctx, java.time.LocalDate localDate)
Date from the LocalDate instance (at start of day).ctx - localDate - Datepublic String format(ExecutionContext ctx, java.time.LocalDate date, String pattern) throws ErrorException
ctx - date - pattern - ErrorExceptionpublic java.time.LocalDate min(ExecutionContext ctx, java.time.LocalDate... dates) throws ErrorException
ctx - dates - ErrorExceptionpublic java.time.LocalDate max(ExecutionContext ctx, java.time.LocalDate... dates) throws ErrorException
ctx - dates - ErrorExceptionCopyright © 2007-2020 Whitestein Technologies. All Rights Reserved.