1

What is the pattern for SimpleDateFormat that produces strings that look like

2013-11-22T14:30:03.2148+02:00

?

Joel Shemtov
  • 3,008
  • 2
  • 22
  • 22

1 Answers1

2

Chek this link. You will find:

yyyy-MM-dd'T'HH:mm:ss.SSSXXX
Sergi
  • 579
  • 3
  • 14
  • This does not work for JDK <= 6. Right? – peter.petrov Jan 09 '14 at 11:43
  • @peter.petrov According to [the doc](http://docs.oracle.com/javase/1.5.0/docs/api/java/text/SimpleDateFormat.html), in JDK5 is `"yyyy-MM-dd'T'HH:mm:ss.SSSZ"`. – Sergi Jan 09 '14 at 11:44
  • This (with the Z) is not doing 100% what the OP wants. This gives: "2014-01-09T06:47:19.078-0500" while OP wants: "2014-01-09T06:47:19.0782-05:00". I am not sure how it can be done with JDK <= 6. – peter.petrov Jan 09 '14 at 11:54
  • I know how. Migrate to JDK7. – Sergi Jan 09 '14 at 12:22
  • Fortunately I am using Java7 so this answer is good enough for me. In fact, yesterday's comment to the question by @peter.petrov had reference to another question with the same answer. Thanks everyone who tried to help – Joel Shemtov Jan 10 '14 at 08:25