public class DateFunctions extends Object
Constructor and Description |
---|
DateFunctions()
Creates new instance.
|
Modifier and Type | Method and Description |
---|---|
Date |
addDurationToDate(ExecutionContext ctx,
Date date,
RecordHolder duration)
Returns a date obtained by adding the duration to the date.
|
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 |
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 |
getDayOfWeek(ExecutionContext ctx,
Date 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 |
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 |
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 |
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.
|
Date |
max(Date... values)
Computes max Date from all passed dates
|
Date |
min(Date... values)
Computes minimal Date from all passed dates
|
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 |
today()
Computes current date without time Method will use default time zone of VM
|
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
- ErrorException
public Decimal getEpochMillis(ExecutionContext ctx, Date date) throws ErrorException
ctx
- date
- ErrorException
public Date date(ExecutionContext ctx, String string) throws ErrorException
Date
valuectx
- string
- ErrorException
public Date date(ExecutionContext ctx, String string, String pattern) throws ErrorException
SimpleDateFormat
ctx
- string
- pattern
- ErrorException
public Date date(ExecutionContext ctx, String string, String pattern, String locale) throws ErrorException
SimpleDateFormat
ctx
- string
- pattern
- locale
- ErrorException
public 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
- ErrorException
public 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
- ErrorException
public Date date(ExecutionContext ctx, Decimal year, Decimal month, Decimal dayOfMonth) throws ErrorException
ctx
- year
- month
- dayOfMonth
- ErrorException
public Decimal getYear(ExecutionContext ctx, Date date) throws ErrorException
ctx
- date
- ErrorException
public Decimal getMonth(ExecutionContext ctx, Date date) throws ErrorException
ctx
- date
- ErrorException
public Decimal getWeek(ExecutionContext ctx, Date date) throws ErrorException
ctx
- date
- ErrorException
public Decimal getDayOfYear(ExecutionContext ctx, Date date) throws ErrorException
ctx
- date
- ErrorException
public Decimal getDayOfMonth(ExecutionContext ctx, Date date) throws ErrorException
ctx
- date
- ErrorException
public Decimal getDayOfWeek(ExecutionContext ctx, Date date) throws ErrorException
ctx
- date
- ErrorException
public Decimal getHour(ExecutionContext ctx, Date date) throws ErrorException
ctx
- date
- ErrorException
public Decimal getMinute(ExecutionContext ctx, Date date) throws ErrorException
ctx
- date
- ErrorException
public Decimal getSecond(ExecutionContext ctx, Date date) throws ErrorException
ctx
- date
- ErrorException
public Decimal getMillis(ExecutionContext ctx, Date date) throws ErrorException
ctx
- date
- ErrorException
public Decimal intervalInYears(ExecutionContext ctx, Date date1, Date date2) throws ErrorException
ctx
- date1
- date2
- ErrorException
public Decimal intervalInMonths(ExecutionContext ctx, Date date1, Date date2) throws ErrorException
ctx
- date1
- date2
- ErrorException
public Decimal intervalInWeeks(ExecutionContext ctx, Date date1, Date date2) throws ErrorException
ctx
- date1
- date2
- ErrorException
public Decimal intervalInDays(ExecutionContext ctx, Date date1, Date date2) throws ErrorException
ctx
- date1
- date2
- ErrorException
public Decimal intervalInHours(ExecutionContext ctx, Date date1, Date date2) throws ErrorException
ctx
- date1
- date2
- ErrorException
public Decimal intervalInMinutes(ExecutionContext ctx, Date date1, Date date2) throws ErrorException
ctx
- date1
- date2
- ErrorException
public Decimal intervalInSeconds(ExecutionContext ctx, Date date1, Date date2) throws ErrorException
ctx
- date1
- date2
- ErrorException
public Decimal intervalInMillis(ExecutionContext ctx, Date date1, Date date2) throws ErrorException
ctx
- date1
- date2
- ErrorException
public Date setYear(ExecutionContext ctx, Date date, Decimal year) throws ErrorException
ctx
- date
- year
- ErrorException
public Date setMonth(ExecutionContext ctx, Date date, Decimal month) throws ErrorException
ctx
- date
- month
- ErrorException
public Date setWeek(ExecutionContext ctx, Date date, Decimal week) throws ErrorException
ctx
- date
- week
- ErrorException
public Date setDayOfYear(ExecutionContext ctx, Date date, Decimal dayOfYear) throws ErrorException
ctx
- date
- dayOfYear
- ErrorException
public Date setDayOfMonth(ExecutionContext ctx, Date date, Decimal dayOfMonth) throws ErrorException
ctx
- date
- dayOfMonth
- ErrorException
public Date setDayOfWeek(ExecutionContext ctx, Date date, Decimal dayOfWeek) throws ErrorException
ctx
- date
- dayOfWeek
- ErrorException
public Date setHour(ExecutionContext ctx, Date date, Decimal hour) throws ErrorException
ctx
- date
- hour
- ErrorException
public Date setMinute(ExecutionContext ctx, Date date, Decimal minute) throws ErrorException
ctx
- date
- minute
- ErrorException
public Date setSecond(ExecutionContext ctx, Date date, Decimal second) throws ErrorException
ctx
- date
- second
- ErrorException
public Date setMillis(ExecutionContext ctx, Date date, Decimal millis) throws ErrorException
ctx
- date
- millis
- ErrorException
public Date setDate(ExecutionContext ctx, Date date, Decimal year, Decimal month, Decimal dayOfMonth) throws ErrorException
ctx
- date
- year
- month
- dayOfMonth
- ErrorException
public Date setTime(ExecutionContext ctx, Date date, Decimal hour, Decimal minute, Decimal second, Decimal millis) throws ErrorException
ctx
- date
- hour
- minute
- second
- millis
- ErrorException
public String formatDate(ExecutionContext ctx, Date date, String pattern, String timeZone) throws ErrorException
ctx
- pattern
- date
- timeZone
- ErrorException
public 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)ErrorException
Copyright © 2007-2018 Whitestein Technologies. All Rights Reserved.