Java Time Zone When Parsing DateFormat
Posted
by
shipmaster
on Stack Overflow
See other posts from Stack Overflow
or by shipmaster
Published on 2010-12-27T23:44:00Z
Indexed on
2010/12/28
0:53 UTC
Read the original article
Hit count: 294
I had code that parses date as follows:
String ALT_DATE_TIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSZ";
SimpleDateFormat sdf = new SimpleDateFormat(
ALT_DATE_TIME_FORMAT);
Date date = sdf.parse(requiredTimeStamp);
And it was working fine, suddenly, this stopped working. It turns out an admin made some config changes on the server and the date is currently being returned as "2010-12-27T10:50:44.000-08:00" which is not parse-able by the above pattern. I have two questions:
The first would be what pattern would parse the date being returned by the JVM in the format above (specifically, just '-08:00' as the time zone)? And second, where exactly would one change such settings on a linux RHEL 5 server so that we are aware of such changes in the future?
© Stack Overflow or respective owner