[jboss-user] [Beginners Corner] - Urgent : Time getting different than system time
sonalisalunkhe147
do-not-reply at jboss.com
Thu Oct 18 10:14:36 EDT 2007
In one of the method of one class which is deployed on JBOSS, I have written the following lines of code :
SimpleDateFormat dateFormatterSecondPrecision = new SimpleDateFormat("MM/dd/yyyy kk:mm:ss");
System.setProperty("user.timezone","America/Los_Angeles");
Calendar cal = GregorianCalendar.getInstance(TimeZone.getTimeZone("America/Los_Angeles"));
String strCreatedDate=dateFormatterSecondPrecision.format(cal.getTime());
if(INFO) // used log4j
log.info("..... strCreatedDate : "+strCreatedDate);
java.util.Date createdDate=dateFormatterSecondPrecision.parse(strCreatedDate);
if(INFO)
log.info("..... createdDate : "+createdDate);
The o/p :
..... strCreatedDate : 10/18/2007 13:32:33
..... createdDate : Thu Oct 18 13:32:33 GMT 2007
But if I run the code soley, toatlly written a simple java class which contain the above 4-5 liines,
The o/p is :
..... strCreatedDate : 10/18/2007 19:05:45
..... createdDate : Thu Oct 18 19:05:45 IST 2007
The difference of 5.5 hrs is coming .
Can anybody tell me where i m wrong?
Thanks in advance
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4096579#4096579
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4096579
More information about the jboss-user
mailing list