1

what's the best way to parse this string 2009-05-12T13:40:00Z to a valid java date? I'm not sure for what "T" and "Z" stands for - i guess Z means zulu?

Thanks, Joo

joo
  • 170
  • 1
  • 9

2 Answers2

2

The format string you have is a UTC date/time in the ISO 8601 format. The format is simply the date, a T separator and the UTC time (or zulu time).

java.text.SimpleDateFormatter should perform all the parsing you need.

Alberto Zaccagni
  • 30,779
  • 11
  • 72
  • 106
dhable
  • 2,879
  • 26
  • 35
  • It fails without recognizing the 'T' format symbol. java.lang.IllegalArgumentException: Illegal pattern character 'T' – Rondo Aug 13 '13 at 00:21
0

Note that the patter has some special handling for internal static values like 'T':

See the answer here Illegal pattern character 'T' when parsing a date string to java.util.Date

Community
  • 1
  • 1
Rondo
  • 3,458
  • 28
  • 26