converting the Calendar time in a particular Timezone to a Timestamp time
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   anil_palat
Posted On:   Friday, July 29, 2005 04:19 AM

Iam facing a problem while converting the Calendar time in a particular Timezone to a Timestamp time. The conversion factor is not reflected in the Timestamp value. See the code below for details Calendar usersCalendar = new GregorianCalendar(TimeZone.getTimeZone ("Asia/Calcutta")); Calendar gmt = new GregorianCalendar(TimeZone.getTimeZone ("Greenwich Mean Time")); gmt.setTimeInMillis(usersCalendar.getTimeInMillis()); Timestamp timestamp = new Timestamp(gmt.getTimeInMillis()); After this when I check the time in timestamp object it shows that of usersCalendar object & not of gmt object . Kindly he   More>>

Iam facing a problem while converting the Calendar time in a particular Timezone to a Timestamp time. The conversion factor is not reflected in the Timestamp value. See the code below for details



Calendar usersCalendar =
new GregorianCalendar(TimeZone.getTimeZone
("Asia/Calcutta"));

Calendar gmt =
new GregorianCalendar(TimeZone.getTimeZone
("Greenwich Mean Time"));

gmt.setTimeInMillis(usersCalendar.getTimeInMillis());

Timestamp timestamp = new Timestamp(gmt.getTimeInMillis());




After this when I check the time in timestamp object it shows that of usersCalendar object & not of gmt object .


Kindly help as I require the GMT value to be stored in the Database    <<Less

Re: converting the Calendar time in a particular Timezone to a Timestamp time

Posted By:   Almagest_FUTT  
Posted On:   Monday, August 1, 2005 08:47 AM

If you need GMT, why not use System.currentTimeMillis() ?
About | Sitemap | Contact