This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
java.sql.Date today = new Date(calendar_today.getTime().getTime());
Calendar_today is in a timezone different from the JVM's timezone, when i create a sql.date out of it,using the code above, date is created in the current time zone.how to create a date for a given(calendar_today's) time zone.
The happiest of people don't necessarily have the best of everything;<br />they just make the most of everything that comes along their way
"A thin wrapper around a millisecond value that allows JDBC to identify this as an SQL DATE value. A milliseconds value represents the number of milliseconds that have passed since January 1, 1970 00:00:00.000 GMT."
So the value in a java.sql.Date is always in the GMT timezone. However, if you print it to the screen with System.out.println(...), then it will be displayed as a time in the default timezone. If you use e.g. SimpleDateFormat to convert a date to a string, then you can use setTimeZone(...) on the SimpleDateFormat object to make it format your date in a certain timezone.
So, to answer your question "how to create a date for a given(calendar_today's) time zone.": You don't and you can't, because a Date object has no timezone information. When you convert the Date object to a string, then you can specify the timezone to format the Date in.