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 | ' |
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 |
Asia/Tokyo | America/Los_Angeles |
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) |
PST | Pacific Standard Time |
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. |