/* Author: 101
Date: 09-04-2008
Filename:
Description: Convert Java date to GMT
History:
*/
private static Date cvtToGmt( Date date )
{
TimeZone tz = TimeZone.getDefault();
Date ret = new Date( date.getTime() - tz.getRawOffset() );
// if we're now in DST, back off by the delta. Note that we're checking the GMT date, this is the KEY.
if ( tz.inDaylightTime( ret ))
{
Date dstDate = new Date( ret.getTime() - tz.getDSTSavings() );
// check to make sure we haven't crossed back into standard time
// this happens when we're on the cusp of DST (7pm the day before the change for PDT)
if ( tz.inDaylightTime( dstDate ))
{
ret = dstDate;
}
}
return ret;
}