[ACCEPTED]-How can I recognize the Zulu time zone in Java DateUtils.parseDate?-timezone

Accepted answer
Score: 48

I think commons-lang is using java's built-in 4 DateFormat or SimpleDateFormat which throws 3 a ParseException for your date. If all your 2 input strings end with the trailing Z, you 1 could use this:


java.text.DateFormat df = new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
// explicitly set timezone of input if needed
df.setTimeZone(java.util.TimeZone.getTimeZone("Zulu"));
java.util.Date date = df.parse("2008-12-23T00:00:00Z");
Score: 4

Looks like a bug in commons-lang's FastDateFormat. Tell 3 them about it, and you should get a fix 2 eventually. Till then you could try to preprocess 1 the dates and replace 'Z' with '+00'

More Related questions