A
abhay
Hi all !
How can i convert a date from one timezone to a date in another
timezone ?
I coded the following ... but i feel that it's not correct ...
public Date getConvertedDate(TimeZone tzFrom,TimeZone tzTo,String
date) {
Date retDate = null;
try {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy
HH:mm:ss");
sdf.setTimeZone(tzFrom);
Date dtFrom = sdf.parse(date);
sdf.setTimeZone(tzTo);
retDate = sdf.parse(sdf.format(dtFrom));
} catch(ParseException pe) {
pe.printStackTrace();
}
return retDate;
}
By simply setting the timezone into the simple date format, will i get
a date in that timezone ?
Please comment ...
thanks 4 your help !
warm regards
casper
How can i convert a date from one timezone to a date in another
timezone ?
I coded the following ... but i feel that it's not correct ...
public Date getConvertedDate(TimeZone tzFrom,TimeZone tzTo,String
date) {
Date retDate = null;
try {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy
HH:mm:ss");
sdf.setTimeZone(tzFrom);
Date dtFrom = sdf.parse(date);
sdf.setTimeZone(tzTo);
retDate = sdf.parse(sdf.format(dtFrom));
} catch(ParseException pe) {
pe.printStackTrace();
}
return retDate;
}
By simply setting the timezone into the simple date format, will i get
a date in that timezone ?
Please comment ...
thanks 4 your help !
warm regards
casper