• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SimpleDateFormat returns inconsistent date

 
Sam Kumar
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am seeing very strange problem with SimpleDateFormat, sometime I am seeing
four digit month instead of two between clone. For example first clone (JVM) will
return two digit month "01" and another clone (same code) return four digit
month "0001".
Here is the code snippet:
private static String customTimestamp;
SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss z");
.....
if (customTimestamp == null)
customTimestamp = formatter.format(new java.util.Date());
We are using JDK 1.3.1, WAS 4 AE, AIX
Any thoughts why i am getting different month length.
Thanks.
SK
 
Chinmay Bajikar
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi sushil,
I tried ur code on my machine.
But im gettin consistant results.(4 digit year)
Also what do u mean by JVM clone???
I have run the code on my Win Nt machine on JDK 1.4.
Thanks,
Chinmay
 
Sam Kumar
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Chinmay:
Thanks for your reply.
We are using WebSphere Application Server and for scalability reasons we created cloned AppServer i.e. multiple JVMs are running the same web application.
I am seeing 4 digit month instead of two. For example: For Jan, first JVM shows "01" and 2nd JVM may show "0001". All other informaiton is correct based on format specified in SimpleDateFormat.
Also this problem is not consistent, I saw only twice.
I am using JDK 1.3.1 running on AIX (unix).
Thanks.
Sushil
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic