Date Services
Use Date services to generate and format date values.
Pattern String Symbols - Many of the Date services require you to specify pattern strings describing the data's current format and/or the format to which you want it converted. For services that require a pattern string, use the symbols in the following table to describe the format of your data. For example, to describe a date in the January 15, 1999 format, you would use the pattern string MMMMM dd, yyyy. To describe the format 01/15/99, you would use the pattern string MM/dd/yy.
Symbol | Meaning | Presentation | Example |
G | era designator | Text | AD |
y | year | Number | 1996 or 96 |
M | month in year | Text or Number | July or Jul or 07 |
d | day in month | Number | 10 |
h | hour in am/pm (1-12) | Number | 12 |
H | hour in day (0-23) | Number | 0 |
m | minute in hour | Number | 30 |
s | second in minute | Number | 55 |
S | millisecond | Number | 978 |
E | day in week | Text | Tuesday or Tue |
D | day in year | Number | 189 |
F | day of week in month | Number | 2 (2nd Wed in July) |
w | week in year | Number | 27 |
W | week in month | Number | 2 |
a | am/pm marker | Text | PM |
k | hour in day (1-24) | Number | 24 |
K | hour in am/pm (0-11) | Number | 0 |
z | time zone | Text | Pacific Standard Time or PST or GMT-08:00 |
Z | RFC 822 time zone (JVM 1.4 or later) | Number | -0800 (offset from GMT/UT) |
' | escape for text | Delimiter | |
' ' | single quote | Literal | ' |
Time Zones - When working with date services, you can specify time zones. The Earth is divided into 24 standard time zones, one for every 15 degrees of longitude. Using the time zone including Greenwich, England (known as Greenwich Mean Time, or GMT) as the starting point, the time is increased by an hour for each time zone east of Greenwich and decreases by an hour for each time zone west of Greenwich. The time difference between a time zone and the time zone including Greenwich, England (GMT) is referred to as the raw offset.
The following table identifies the different time zones for the Earth and the raw offset for each zone from Greenwich, England. The effects of daylight savings time are ignored in this table.
Note:
Greenwich Mean Time (GMT) is also known as Universal Time (UT).
ID | Raw Offset | Name |
MIT | -11 | Midway Islands Time |
HST | -10 | Hawaii Standard Time |
AST | -9 | Alaska Standard Time |
PST | -8 | Pacific Standard Time |
PNT | -7 | Phoenix Standard Time |
MST | -7 | Mountain Standard Time |
CST | -6 | Central Standard Time |
EST | -5 | Eastern Standard Time |
IET | -5 | Indiana Eastern Standard Time |
PRT | -4 | Puerto Rico and U.S. Virgin Islands Time |
CNT | -3.5 | Canada Newfoundland Time |
AGT | -3 | Argentina Standard Time |
BET | -3 | Brazil Eastern Time |
GMT | 0 | Greenwich Mean Time |
ECT | +1 | European Central Time |
CAT | +2 | Central Africa Time |
EET | +2 | Eastern European Time |
ART | +2 | (Arabic) Egypt Standard Time |
EAT | +3 | Eastern African Time |
MET | +3.5 | Middle East Time |
NET | +4 | Near East Time |
PLT | +5 | Pakistan Lahore Time |
IST | +5.5 | India Standard Time |
BST | +6 | Bangladesh Standard Time |
VST | +7 | Vietnam Standard Time |
CTT | +8 | China Taiwan Time |
JST | +9 | Japan Standard Time |
ACT | +9.5 | Australian Central Time |
AET | +10 | Australian Eastern Time |
SST | +11 | Solomon Standard Time |
NST | +12 | New Zealand Standard Time |
Examples - You can specify timezone input parameters in the following formats:
As a full name. For example:
Asia/Tokyo | America/Los_Angeles |
You can use the java.util.TimeZone.getAvailableIDs() method to obtain a list of the valid full name time zone IDs that your JVM version supports.
As a custom time zone ID, in the format GMT[+ | -]hh[ [:]mm]. For example:
GMT+2:00 | All time zones 2 hours east of Greenwich (that is, Central Africa Time, Eastern European Time, and Egypt Standard Time) |
GMT-3:00 | All time zones 3 hours west of Greenwich (that is, Argentina Standard Time and Brazil Eastern Time) |
GMT+9:30 | All time zones 9.5 hours east of Greenwich (that is, Australian Central Time) |
As a three-letter abbreviation from the table above. For example:
Note:
Because some three-letter abbreviations can represent multiple time zones, for example, "CST" could represent both U.S. "Central Standard Time" and "China Standard Time", all abbreviations are deprecated. Use the full name or custom time zone ID formats instead.
Notes on Invalid Dates - The dates you use with a date service must adhere to the java.text.SimpleDateFormat class.
If you use an invalid date with a date service, the date service automatically translates the date to a legal date. For example, if you specify 1999/02/30 as input, the date service interprets the date as 1999/03/02 (two days after 2/28/1999).
If you use 00 for the month or day, the date service interprets 00 as the last month or day in the Gregorian calendar. For example, if you specify 00 for the month, the date service interprets it as 12.
If the pattern yy is used for the year, the date service uses a 50-year moving window to interpret the value of yy. The date service establishes the window by subtracting 49 years from the current year and adding 50 years to the current year. For example, if you are running Integration Cloud in the year 2000, the moving window would be from 1951 to 2050. The date service interprets 2-digit years as falling into this window (for example, 12 would be 2012, 95 would be 1995).
The following Date services are available:
Service | Description |
| Calculates the difference between two dates and returns the result as seconds, minutes, hours, and days. |
| Compares two dates and returns the result as integer. |
| Returns the current time returned by the most precise system timer, in nanoseconds. |
| Builds a date String using the specified pattern and the specified date services. |
| Builds a date/time string using the specified pattern and the specified date services. |
| Converts date/time (represented as a String) string from one format to another. |
| Calculates the time elapsed between the current time and the given time, in nanoseconds. |
| Formats a Date object as a string. |
| Returns the current date as a Date object. |
| Returns the current date as a String in a specified format. |
| Increments a date by a specified period. |