You are here: Record management > Building expressions with the Expression Builder > Functions in expressions > DateTimeNative functions

DateTimeNative functions

The functions in the DateTimeNative library offer increased performance for date and time calculations, because they do not require data type conversions.

Replace the following deprecated functions with the DateTimeNative library functions.

Deprecated function Replacement function Description
addCalendar pxAddCalendar(Date theDate, int years, int months, int weeks, int days, int hours, int minutes, int seconds) Returns the specified years, months, weeks, days, hours, minutes, and seconds to the DateTime passed in (or the current DateTime if no DateTime is passed) and returns the resulting DateTime.
addToDate pxAddToDate(Date theDate, int days, int hours, int minutes, int seconds) Returns the specified days, hours, minutes, and seconds to the DateTime passed in (or the current DateTime if no DateTime is passed) and returns the resulting DateTime.
CompareDates pxCompareDates(Date date1, Date date2) Compares two DateTime values and returns true if the first date argument is after the second.
CompareDates pxCompareDates(Date date1, Date date2, boolean daysOnly) Compares two DateTime values. Compare by date only if daysOnly is true; return true if date1 is after date2.
compareDatesByDays pxCompareDatesByDays(Date firstDate, Date secondDate, int numberofDays) Compares the date part of two DateTime strings and returns true if the first date argument exceeds the second date by more than numberOfDays.
CompareDateTimeStamp pxCompareDateTimeStamp(Date date1, Date date2) Compares two DateTime values and returns true if the dates are equal.
CurrentDate pxCurrentDate Returns the current system date and time as a DateTime value.
pxDateTimeisPastOrFuture pxDateIsPastOrFuture(Date compareDate, boolean checkIfPass) Compares a date with the current date to see if it is in the past or in the future.
DateTimeDifference pxDateTimeDifference(Date beginTime, Date endTime, String strPrecision) Returns the time difference, as a double value, between two DateTime values according to the specified precision.
DateTimeDuration pxDateTimeDuration(Date beginTime, Date endTime, String strPrecision) Returns the time difference, as a string, between two DateTimes according to the specified precision.
dateValue pxDateValue(Date theDate) Converts a specified DateTime to a number of days since January 1, 1970.
pzGetConvertedDateTimeString pxGetConvertedDateTimeString(Date theDate, String timeZone, String pattern) Takes the specified Date input and converts it into a DateTime in the specified time zone and into the specified pattern.
isWithinDaysOfNow pxIsWithinDaysOfNow(Date theDate, int days) Determines whether input is within a specified number of days of the present time.
TimeDifference pxTimeDifference(Date startDate, int nDays, int nHours, int nMinutes, int nSeconds) Returns the specified number of days, hours, minutes, and seconds to a Date by using the server's default calendar and GMT time zone.
TimeDifferenceBusinessDays pxTimeDifferenceBusiness(Calander aCalandar, Date startDate, int nDays, int nHours, int nMinutes, int nSeconds) Returns the specified number of days, hours, minutes, and seconds to a Date by using the specified calendar.
TimeDifferenceFirstBusinessDay pxTimeDifferenceFirstBusinessDay(Calandar aCalandar, Date startDate) Returns the first business day after the specified DateTime by using the specified calendar.
timevalue pxTimeValue(Date pegaRulesDate) Gets a BigDecimal value of the parsed DateTime String specified.