DateTime functions
The following functions operate with date and time values. A
DateTime
property type represents an instant in time while
Date
and
TimeofDay
property types represent values. Adding (the BigDecimal/double values corresponding to) a
Date
and a
TimeofDay
together similarly represents an instant in time, but in an unknown or arbitrary time zone.
Syntax | Description |
---|---|
These Rule-Utility-Function rules are similar to the corresponding functions in Microsoft Excel. | |
@date(year, month, day) | Returns a BigDecimal value ( Pega Platform Date) corresponding to the int parameters specified. The year is a four digit year, and is not adjusted for a “base date.” The parameters are interpreted leniently (as in Microsoft Excel) through the use of the Java Calendar class. |
@datevalue(string) | Returns a BigDecimal value ( Pega Platform Date) corresponding to the parsed value of the string specified. Only the date portion of the string is considered. |
@day(double) @day(BigDecimal)) | Returns the int value corresponding to the day of the month (1 to 31) when the double parameter is interpreted as a Pega Platform Date. |
@month(double) @month(BigDecimal) | Returns the Java int value corresponding to the month of the year (0 to 11) when the double parameter is interpreted as a Pega Platform Date. The corresponding Excel function also returns 0 to 11. |
@today() @today(selection) | Returns the BigDecimal value ( Pega Platform Date) corresponding to the current date. |
@weekday(double) @weekday(BigDecimal) | Returns the int value corresponding to the day of the week (Sunday = 1 to Saturday = 7) when the double parameter is interpreted as a Pega Platform Date. |
@year(double) @year(BigDecimal) | Returns the int value corresponding to the year when the double parameter is interpreted as a Pega Platform Date. |
@hour(double) @hour(BigDecimal) | Returns the Java int value corresponding to the hour of the day (0 to 23) when the double parameter is interpreted as a Pega Platform Time of Day. |
@minute(double) @minute(BigDecimal) | Returns the Java int value corresponding to the minute of the hour (0 to 59) when the double parameter is interpreted as a Pega Platform Time of Day. |
@second(double) @second(BigDecimal) | Returns the Java int value corresponding to the second of the minute (0 to 59) when the double parameter is interpreted as a Pega Platform Time of Day. |
@time(hour, minute, second) | Returns a BigDecimal value ( Pega Platform Time of Day) corresponding to the int parameters specified. |
@timevalue(string) | Returns a BigDecimal value (a Pega Platform Time of Day value) corresponding to the parsed value of the string specified. Only the time portion of the string is considered. |
The following functions facilitate conversion between BigDecimal/double values derived from DateTime properties and Date or Time of Day properties. Use these functions to adjust the double value resulting from the sum of a Date and Time of Day, or the double value resulting from a DateTime property into a (possibly different) known time zone. The return type of these functions is the same as the type of the first argument. | |
@toGMT(double, zone) @toGMT(BigDecimal, zone) | Returns a double/BigDecimal value ( Pega Platform DateTime) in the GMT time zone corresponding to the double value interpreted in the “zone” time zone. Use to convert the sum of a Date and Time of Day to a DateTime. If zone is null, then the time zone of the requestor is used. |
@toLOCAL(double, zone) @toLOCAL(BigDecimal, zone) | Returns a double/BigDecimal value that is the result of treating the double value as a Pega Platform DateTime (in the GMT time zone) and converting it to the time zone. You can then treat the resulting value as Date and Time of Day values in the specified time zone. If zone is null, then the time zone of the requestor session is used. For example, if bostonTime is a double value that represents a date and time in the Eastern Standard Time zone, you can find the corresponding time in India by using: toLOCAL(toGMT(bostonTime, “EST”), “IST”). |