The Java SimpleDateFormat class can represent many date formats including SSSXXX. Each letter in the date can signify date, time, timezone or some other things.

SSSXXX represents milliseconds and timezone.

  • SSS – 3 digit milliseconds.
  • XXX – Timezone in hour:minute format with appropriate signs (+/-)
yyyy-MM-dd'T'HH:mm:ss.SSSXXX

// It could be 2001-07-04T12:08:56.235-07:00

In our code example SSS = 235 and XXX = -07:00

Check out the list of all the date and time patterns –

LetterDate or Time ComponentPresentationExamples
GEra designatorTextAD
yYearYear199696
YWeek yearYear200909
MMonth in yearMonthJulyJul07
wWeek in yearNumber27
WWeek in monthNumber2
DDay in yearNumber189
dDay in monthNumber10
FDay of week in monthNumber2
EDay name in weekTextTuesdayTue
uDay number of week (1 = Monday, …, 7 = Sunday)Number1
aAm/pm markerTextPM
HHour in day (0-23)Number0
kHour in day (1-24)Number24
KHour in am/pm (0-11)Number0
hHour in am/pm (1-12)Number12
mMinute in hourNumber30
sSecond in minuteNumber55
SMillisecondNumber978
zTime zoneGeneral time zonePacific Standard TimePSTGMT-08:00
ZTime zoneRFC 822 time zone-0800
XTime zoneISO 8601 time zone-08-0800-08:00

    Tweet this to help others

Tagged in:

,

Comments

About the Author

akamit

I am Akash Mittal, an overall computer scientist. If you want to guest post, need help in your projects, want to advertise, Feel free to contact me at [email protected]

View All Articles