SimpleDateFormat can give strange results when running on a server when multiple threads share the same instance. This is because it is not thread-safe due to intermediate results being stored in instance variables. To avoid this problem always instantiate a new SimpleDateFormat object when needed or find a way to ensure there is one instance per thread (e.g. using ThreadLocal).
References:
No comments:
Post a Comment