public interface DateTimeUtils
"MMM dd',' yyyy '-' HH:mm:ss z"
Short Datetime: "MM/dd/yy KK:mm a"
- Server's default timezone
Long Date: "MMM dd',' yyyy"
Short Date: "MM/dd/yy"
Short Time 1: "HH:mm:ss z"
Short Time 2: "KK:mm:ss a"
- Server's default timezone
Timestamp: "HHmmss"
- always considered to be in GMT
The 'Standard Pega ISO Date', Pega TimeStamp or datetimestamp is referred to here
and elsewhere and is the format used for internal storage of dates and times within
PegaRULES.
The java.util.Date formatting pattern looks like this:
"yyyyMMdd'T'HHmmss.SSS 'GMT'"
Legend for all these time format strings:
yyyy
is the string containing 4 digit year.
MM
is the string containing a 2 digit month, valid values are 01..12
dd
is the string containing a 2 digit day, valid values are 01..31 (with the usual constraints.)
HH
is the string containing a 2 digit hour, valid values are 00..23.
KK
is the string containing a 2 digit hour, valid values are 00..11 (has am/pm).
mm
is the string containing a 2 digit minute, valid values are 00..59
ss
is the string containing a 2 digit second, valid values are 00..59
sss
is the string containing a 3 digit millisecond, valid values are 000..999
a
is the placeholder for the AM/PM indicator - hour always coded with KK.
GMT
is constant and indicates that the timestamp is always stored
as a Greenwich Mean Time.Modifier and Type | Interface and Description |
---|---|
static class |
DateTimeUtils.DateTypes |
static class |
DateTimeUtils.Precision |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COPYRIGHT |
static java.lang.String |
VERSION |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
addCalendar(java.lang.String aDate,
java.lang.String aYears,
java.lang.String aMonths,
java.lang.String aWeeks,
java.lang.String aDays,
java.lang.String aHours,
java.lang.String aMinutes,
java.lang.String aSeconds) |
java.util.Date |
addMonthsToSameDay(java.util.Date aDate,
int aNumOfMonths)
This function will return a date
numOfMonths from the
specified date, where the day of the week and week of the month are the
same. |
java.lang.String |
addMonthsToSameDay(java.lang.String aDate,
int aNumOfMonths)
This function will return a date
numOfMonths from the
specified date, where the day of the week and week of the month are the
same. |
java.util.Date |
addToDate(java.util.Date aDate,
int aDays,
int aHours,
int aMinutes,
int aSeconds)
This function will add days, hours,minutes,seconds to the time passed in
and will return an ISO time to the caller.
|
java.lang.String |
addToDate(java.lang.String aDate,
java.lang.String aDays,
java.lang.String aHours,
java.lang.String aMinutes,
java.lang.String aSeconds)
This function will add days, hours,minutes,seconds to the time passed in
and will return an ISO time to the caller.
|
java.lang.String |
currentDate(java.lang.String aDateFormat,
java.lang.String aTimeZone)
Return Today's Date - Keep track of system starts
|
long |
currentTimeUnique()
return a long that is unique within this PegaRULES jvm/instance by
incrementing a counter while currentTimeMillis remains constant
|
com.pega.ibm.icu.math.BigDecimal |
date(int aYear,
int aMonth,
int aDay)
returns the difference in days between the Calendar start date and given
input date as BigDecimal value
|
com.pega.ibm.icu.math.BigDecimal |
dateStringToBigDecimal(java.lang.String aDateString,
DateTimeUtils.DateTypes aDateType)
Converts a date time string to a BigDecimal depending on dateType ,the
return value is based on the time only, date only, or full DateTime.
|
double |
dateTimeDifference(java.util.Date aBeginTime,
java.util.Date aEndTime,
DateTimeUtils.Precision aPrecision)
Computes the difference between two Pega standard internal (ISO) format
dates with the result being corrected for the specified precision.
|
double |
dateTimeDifference(java.lang.String aBeginTime,
java.lang.String aEndTime,
java.lang.String aPrecision)
Computes the difference between two Pega standard internal (ISO) format
dates with the result being corrected for the specified precision.
|
java.lang.String |
dateTimeDuration(java.util.Date aBeginTime,
java.util.Date aEndTime,
DateTimeUtils.Precision aPrecision)
compute the difference between two dates (passed as strings)
|
java.lang.String |
dateTimeDuration(java.lang.String aBeginTime,
java.lang.String aEndTime,
java.lang.String aPrecision)
compute the difference between two dates (passed as strings)
|
java.lang.String |
formatDateStamp(java.util.Date aDate)
Format the specified date as a PegaRULES date stamp (yyyyMMdd)
|
java.lang.String |
formatDateTime(java.lang.String aDateTime,
java.lang.String aPattern,
java.lang.String aTimeZone,
java.lang.String aLocale)
(re)format a date/time string using the specified parameters
|
java.lang.String |
formatDateTime(java.lang.String aDateTime,
java.lang.String aPattern,
java.lang.String aTimeZone,
java.lang.String aLocale,
boolean aSupport24hr)
(re)format a date/time string using the specified parameters
|
java.lang.String |
formatDateTimeStamp(java.util.Date aDateTime)
Format the specified time as a PegaRULES time stamp (ISO format, GMT
zone)
|
java.lang.String |
formatTimeOnlyStamp(java.util.Date aTime)
Format the specified Time as a PegaRULES Time stamp (HHmmss [assumed
GMT])
|
java.lang.String |
formatTimeStamp(java.util.Date aTime)
Format the specified Time as a PegaRULES Date Time stamp (ISO format, GMT
zone) Note that this method returns a date/time, not a time, for backward
compatibility purposes.
|
java.lang.String |
getCurrentTimeStamp()
Returns the current date and time as a PegaRULES time stamp (ISO format,
GMT zone)
|
java.util.Date |
getDate(java.lang.String aZeusDateTime)
Coverts an internal date time stamp into a Java Date object.
|
double |
getDifferenceInDays(java.util.Date aBeginDate,
java.util.Date aEndDate) |
boolean |
isBefore(java.lang.String strBeginTime,
java.lang.String strEndTime)
If either of the inputs are invalid or null then IllegalArgumentException is thrown
|
java.util.Date |
nextBusinessDay(java.util.Calendar aCalendar,
java.util.Date aDate)
returns the first business day after the specified date, using
"business day" logic assumes US business day rules (Saturday/Sunday
closed), ignores possibility of holidays (constant 5 day weeks).
|
long |
parseDateString(java.lang.String aDate)
Attempts to interpret the string s as a representation of a date
and time.
|
java.util.Date |
parseDateTimeStamp(java.lang.String aDateTime)
Converts string form of datetimestamp to a Date object.
|
java.util.Date |
parseDateTimeString(java.lang.String aDateTime)
Converts string containing various formats of date & datetime into a Date
object.
|
java.util.Date |
parseTimeOfDayString(java.lang.String aTime)
Converts string form of timestamp to a Date object.
|
java.lang.String |
timeDifference(java.lang.String aStart,
int aDays,
int aHours,
int aMinutes,
int aSeconds)
adds an interval to the specified time, using "business day" logic see
TimeDifferenceBusinessDays uses the server's default calendar and GMT
time zone
|
java.util.Date |
timeDifferenceBusinessDays(java.util.Calendar aCalendar,
java.util.Date aStartDate,
int aDays,
int aHours,
int aMinutes,
int aSeconds)
adds an interval to the specified time, using "business day" logic
assumes US business day rules (Saturday/Sunday closed), ignores
possibility of holidays (constant 5 day weeks).
|
java.lang.String |
timeDifferenceBusinessDays(java.util.Calendar aCalendar,
java.lang.String aStart,
int aDays,
int aHours,
int aMinutes,
int aSeconds)
adds an interval to the specified time, using "business day" logic
assumes US business day rules (Saturday/Sunday closed), ignores
possibility of holidays (constant 5 day weeks).
|
java.lang.String |
timeDifferenceFirstBusinessDay(java.util.Calendar aCalendar,
java.lang.String aStart)
returns the first business day after the specified date, using
"business day" logic assumes US business day rules (Saturday/Sunday
closed), ignores possibility of holidays (constant 5 day weeks).
|
com.pega.ibm.icu.math.BigDecimal |
toDateTime(java.lang.String aDateString)
Converts the given input date String to BigDecimal by setting 'dateType'
to DateTime
|
com.pega.ibm.icu.math.BigDecimal |
today()
returns the difference in days between the Calendar start date(Jan 1st,
1970) and current date as BigDecimal value
|
static final java.lang.String VERSION
static final java.lang.String COPYRIGHT
java.lang.String addToDate(java.lang.String aDate, java.lang.String aDays, java.lang.String aHours, java.lang.String aMinutes, java.lang.String aSeconds)
aDate
- base date to start with, if empty defaults to current dateaDays
- to add to base dateaHours
- to add to base dateaMinutes
- to add to base dateaSeconds
- to add to base datejava.util.Date addToDate(java.util.Date aDate, int aDays, int aHours, int aMinutes, int aSeconds)
aDate
- base date to start with, if null defaults to current dateaDays
- to add to base dateaHours
- to add to base dateaMinutes
- to add to base dateaSeconds
- to add to base datejava.lang.String currentDate(java.lang.String aDateFormat, java.lang.String aTimeZone)
aDateFormat
- format string to use for creating the dateaTimeZone
- Time Zone namelong currentTimeUnique()
double dateTimeDifference(java.lang.String aBeginTime, java.lang.String aEndTime, java.lang.String aPrecision)
aBeginTime
- Start date formatted in standard internal form.aEndTime
- Ending date formatted in standard internal form.aPrecision
- Units the result is to be interpreted with:
double dateTimeDifference(java.util.Date aBeginTime, java.util.Date aEndTime, DateTimeUtils.Precision aPrecision)
aBeginTime
- Start date formatted in standard internal form.aEndTime
- Ending date formatted in standard internal form.aPrecision
- Units the result is to be interpreted with:
java.util.Date parseTimeOfDayString(java.lang.String aTime)
aTime
- PegaRULES standard timestamp string (HHmmss)java.util.Date getDate(java.lang.String aZeusDateTime)
aZeusDateTime
- java.lang.String getCurrentTimeStamp()
java.lang.String addMonthsToSameDay(java.lang.String aDate, int aNumOfMonths)
numOfMonths
from the
specified date, where the day of the week and week of the month are the
same.
For example, the gregorian date May 1, 2004 is the first Saturday of the month. Adding 1 month to that will return June 5, 2004, which is also the first Saturday of the month.
aDate
- base date to start with, if empty defaults to current dateaNumOfMonths
- number of months to add to that datejava.util.Date addMonthsToSameDay(java.util.Date aDate, int aNumOfMonths)
numOfMonths
from the
specified date, where the day of the week and week of the month are the
same.
For example, the gregorian date May 1, 2004 is the first Saturday of the month. Adding 1 month to that will return June 5, 2004, which is also the first Saturday of the month.
aDate
- base date to start with,aNumOfMonths
- number of months to add to that datejava.lang.NullPointerException
- if theDate is nulljava.lang.String dateTimeDuration(java.lang.String aBeginTime, java.lang.String aEndTime, java.lang.String aPrecision)
aBeginTime
- starting timeaEndTime
- ending timeaPrecision
- desired precision, one of "CYMDhmsS" to specify century, year,
month, hour, minute, second, or millisecond respectivelyjava.lang.String dateTimeDuration(java.util.Date aBeginTime, java.util.Date aEndTime, DateTimeUtils.Precision aPrecision)
aBeginTime
- starting timeaEndTime
- ending timeaPrecision
- desired precision, one of "CYMDhmsS" to specify century, year,
month, hour, minute, second, or millisecond respectivelylong parseDateString(java.lang.String aDate)
It accepts many syntaxes; in particular, it recognizes the IETF standard date syntax: "Sat, 12 Aug 1995 13:30:00 GMT". It also understands the continental U.S. time-zone abbreviations, but for general use, a time-zone offset should be used: "Sat, 12 Aug 1995 13:30:00 GMT+0430" (4 hours, 30 minutes west of the Greenwich meridian). If no time zone is specified, the local time zone is assumed. GMT and UTC are considered equivalent.
The string s is processed from left to right, looking for data of interest. Any material in s that is within the ASCII parenthesis characters ( and ) is ignored. Parentheses may be nested. Otherwise, the only characters permitted within s are these ASCII characters:
and whitespace characters.abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789,+-:/
A consecutive sequence of decimal digits is treated as a decimal number:
SimpleDateFormat
.
A consecutive sequence of letters is regarded as a word and treated as follows:
Once the entire string s has been scanned, it is converted to a time result in one of two ways. If a time zone or time-zone offset has been recognized, then the year, month, day of month, hour, minute, and second are interpreted in UTC and then the time-zone offset is applied. Otherwise, the year, month, day of month, hour, minute, and second are interpreted in the local time zone.
aDate
- a string to be parsed as a date.officially deprecated As of JDK version 1.1,
replaced by DateFormat.parse(String s)
.
java.util.Date parseDateTimeStamp(java.lang.String aDateTime)
aDateTime
- PegaRULES standard date/time stringjava.util.Date parseDateTimeString(java.lang.String aDateTime)
aDateTime
- The various supported input date formats.java.lang.String formatDateTime(java.lang.String aDateTime, java.lang.String aPattern, java.lang.String aTimeZone, java.lang.String aLocale)
aDateTime
- input time stringaPattern
- (unused)aTimeZone
- timezone for output string, if null, the server's default is
usedaLocale
- locale to use for formatting, if null, the server's default is
usedjava.lang.String formatDateTime(java.lang.String aDateTime, java.lang.String aPattern, java.lang.String aTimeZone, java.lang.String aLocale, boolean aSupport24hr)
aDateTime
- input time stringaPattern
- (unused)aTimeZone
- timezone for output string, if null, the server's default is
usedaLocale
- locale to use for formatting, if null, the server's default is
usedaSupport24hr
- java.lang.String formatDateTimeStamp(java.util.Date aDateTime)
aDateTime
- Date objectjava.lang.String formatDateStamp(java.util.Date aDate)
aDate
- Date objectjava.lang.String formatTimeStamp(java.util.Date aTime)
aTime
- objectjava.lang.String formatTimeOnlyStamp(java.util.Date aTime)
aTime
- objectjava.lang.String timeDifference(java.lang.String aStart, int aDays, int aHours, int aMinutes, int aSeconds)
aStart
- base date/time, if null or zero length, uses the current date
and timeaDays
- number of days to addaHours
- number of hours to addaMinutes
- number of minutes to addaSeconds
- number of seconds to addjava.lang.String timeDifferenceBusinessDays(java.util.Calendar aCalendar, java.lang.String aStart, int aDays, int aHours, int aMinutes, int aSeconds)
aCalendar
- calendar to be used for computation, if null, uses the
server's default calendar and local time zoneaStart
- base date/time, if null or zero length, uses the current date
and timeaDays
- number of days to addaHours
- number of hours to addaMinutes
- number of minutes to addaSeconds
- number of seconds to addjava.util.Date timeDifferenceBusinessDays(java.util.Calendar aCalendar, java.util.Date aStartDate, int aDays, int aHours, int aMinutes, int aSeconds)
aCalendar
- calendar to be used for computation, if null, uses the
server's default calendar and local time zoneaStartDate
- base date/time, if null or zero length, uses the current date
and timeaDays
- number of days to addaHours
- number of hours to addaMinutes
- number of minutes to addaSeconds
- number of seconds to addjava.lang.String timeDifferenceFirstBusinessDay(java.util.Calendar aCalendar, java.lang.String aStart)
aCalendar
- calendar to be used for computation, if null, uses the
server's default calendar and GMT time zoneaStart
- base date/time, if null or zero length, uses the current date
and timejava.util.Date nextBusinessDay(java.util.Calendar aCalendar, java.util.Date aDate)
aCalendar
- calendar to be used for computation, if null, uses the
server's default calendar and GMT time zoneaDate
- base date/time, if null or zero length, uses the current date
and timecom.pega.ibm.icu.math.BigDecimal today()
com.pega.ibm.icu.math.BigDecimal toDateTime(java.lang.String aDateString)
aDateString
- input datetime Stringcom.pega.ibm.icu.math.BigDecimal date(int aYear, int aMonth, int aDay)
aYear
- input year after 1970aMonth
- input month of year with January starting from 1aDay
- input day of month with first day of month starting from 1com.pega.ibm.icu.math.BigDecimal dateStringToBigDecimal(java.lang.String aDateString, DateTimeUtils.DateTypes aDateType)
aDateString
- input datetime StringaDateType
- input dateType String (TimeOfDay, Date, or DateTime)boolean isBefore(java.lang.String strBeginTime, java.lang.String strEndTime)
strBeginTime
- Start date formatted in standard internal form.strEndTime
- Ending date formatted in standard internal form.double getDifferenceInDays(java.util.Date aBeginDate, java.util.Date aEndDate)
aBeginDate
- aEndDate
- java.lang.String addCalendar(java.lang.String aDate, java.lang.String aYears, java.lang.String aMonths, java.lang.String aWeeks, java.lang.String aDays, java.lang.String aHours, java.lang.String aMinutes, java.lang.String aSeconds)
aDate
- Date to which given years, months, weeks, days, hours, minutes, and seconds will be addedaYears
- aYears number of days to addaMonths
- aMonths number of days to addaWeeks
- aWeeks number of days to addaDays
- aDays number of days to addaHours
- aHours number of days to addaMinutes
- aMinutes number of days to addaSeconds
- aSeconds number of days to addCopyright © 2018 Pegasystems Inc. All Rights Reserved.