Charles Bell
Posts: 519
Nickname: charles
Registered: Feb, 2002
|
|
Re: Need help with dates
|
Posted: Jan 25, 2003 7:17 PM
|
|
I do not know what IST stands for?
In the U.S. there is EST, CST, MST, and PST or under daylight savings time, EDT, CDT, MDT, and PDT.
GMT is Greenwich Mean Time or UT.
EST = GMT - 5 hours. CST = GMT - 6 hours. MST = GMT - 7 hours. PST = GMT - 8 hours.
EDT = GMT - 6 hours + 1 hour. CDT = GMT - 6 hours + 1 hour. MDT = GMT - 7 hours + 1 hour. PDT = GMT - 8 hours + 1 hour.
Since an hour is 3600 seconds or 3600 x 1000 milliseconds, it should be easy to convert any date to a different time zone.
Date date1 = new Date(); long millisecs= date1.getTime(). long oneHourMillisecs = 3600 * 1000; long hoursOffset = 5; Date date2 = new Date(millisecs + hoursOffset * oneHourMillisecs);
|
|