Date time functions in Pega

This Post is about the date time functions in pega and how to use them.
Everytime I need to use Pega function which I have rarely used , I try to find, how to pass the parameters from references and try the same , this post is going to help me to check all the syntax of frequently used functions in single page.


Click the button to copy the syntax now

Function Get current date time
Syntax
Notes Returns the Current Date time in GMT Format
For example: @CurrentDateTime()
Function Format date Time (accept only Datetime)
Syntax
Notes Returns the formatted Date time in GMT Format For example:@DateTime.FormatDateTime("20200611T020304.000 GMT","dd/MM/yyyy","","")
@DateTime.FormatDateTime("20200611T020304.000 GMT","yyyy-MM-dd HH:mm:ss a","Europe/London","en_GB")
Function Add to Date (accept only Date/Datetime)
Syntax
Notes Returns the Modified Date time in GMT Format after adding days,hr,mins,seconds For example: @DateTime.addToDate("20200611T020304.000 GMT",1,2,3,4)
@DateTime.addToDate("20200610",1,2,3,4)
Function Date Time Difference (accept only Datetime)
Syntax
Notes Returns the Date time difference in decimal Format
Precision: C-century, Y-Year, M-Month, D-Days, h-hour, m-minutes, s-seconds, S-microseconds
For example:
@DateTime.DateTimeDifference("20200611T020304.000 GMT","20210611T020304.000 GMT",Y)
Function compare two Dates By Days
Syntax
Notes Returns true if Big date is greater than small date by no of days
For example:
@DateTime.compareDatesByDays("20200614T020304.000 GMT","20200609T020304.000 GMT",4)
Function Get base date from integer
Syntax
Notes Returns a BigDecimal value of difference between the year, month, day and Jan 1 ,1970
For example: @date(2009,2,1)
Function Get base date from string
Syntax
Notes Returns a BigDecimal value of difference between the specificed string
For example: @dateValue("20200621T114952.842 GMT")
@dateValue("20200621")

Function Get Date[1 to 31] from BigDecimal
Syntax
Notes Returns the int value corresponding to the day from Bigdecimal/Double
For example: @day(18434)
@day(@dateValue("20200621T114952.842 GMT"))

Function Get month[1 to 11]from BigDecimal
Syntax
Notes Returns the int value corresponding to the month from Bigdecimal/Double
For example: @month(18434)
@month(@dateValue("20200621T114952.842 GMT"))

Function Get Year from BigDecimal
Syntax
Notes Returns the int value corresponding to the year from Bigdecimal/Double
For example: @year(18434)
@year(@dateValue("20200621T114952.842 GMT"))
Function Get today date in BigDecimal
Syntax
Notes Returns the BigDecimal value (Pega Platform Date) corresponding to the current date
For example: @today()


Please comment , if you need any function to be included here

Post a Comment