JavaServer Pages (JSP) and JSTL - Issues related TimeZOnes and Time
1) In my MYSQL database there is column of type DATETIME name is "ts"
assume my database is located in America/Any other part of the world , Then the local time of america will be stored in MYSQL ts (DATETIME) column.
2) Now i want to convert that local time in AMerica into TImezone of india/calcutta
For that i am using the following code .
// 1) Define a Calendar with correct time zone
// 2) Intialize the Calendar with the proper number of milliseconds
//rs is result set
ts1= rs.getTimestamp("ts")
Calendar local = Calendar.getInstance(TimeZone.getTimeZone("Asia/Calcutta"));
//ts1,getTime will give time in Milliseconds
local.setTimeInMillis(ts1.getTime());
int dayofthemonth = local.get(Calendar.DAY_OF_MONTH);
int month = local.get(Calendar.MONTH);
int year = local.get(Calendar.YEAR);
month = month + 1;
Is the above procedure is Correct?
My Server is located in America and iam rendering the jsp webpages in India I could not able to get the proper time.
Is there any flaw in the above code?
Thanks
Rama

