public static java.util.Date convertTimeZone(java.util.Date date,TimeZone fromTZ,TimeZone toTZ){
  long fromTZDst=0;
  if (fromTZ.inDaylightTime(date)) {
    fromTZDst=fromTZ.getDSTSavings();
  }
  long fromTZOffset=fromTZ.getRawOffset() + fromTZDst;
  long toTZDst=0;
  if (toTZ.inDaylightTime(date)) {
    toTZDst=toTZ.getDSTSavings();
  }
  long toTZOffset=toTZ.getRawOffset() + toTZDst;
  return new java.util.Date(date.getTime() + (toTZOffset - fromTZOffset));
}

public static java . util . Date convertTimeZone ( java . util . Date date , TimeZone fromTZ , TimeZone toTZ ) { long fromTZDst = 0 ; if ( fromTZ . inDaylightTime ( date ) ) { fromTZDst = fromTZ . getDSTSavings ( ) ; } long fromTZOffset = fromTZ . getRawOffset ( ) + fromTZDst ; long toTZDst = 0 ; if ( toTZ . inDaylightTime ( date ) ) { toTZDst = toTZ . getDSTSavings ( ) ; } long toTZOffset = toTZ . getRawOffset ( ) + toTZDst ; return new java . util . Date ( date . getTime ( ) + ( toTZOffset - fromTZOffset ) ) ; }
converttimezone move the timezone from system to market this is only needed because jpa 2 . 1 does not support zoneddatetime i . e . est 9 : 30 gets converted to pc datetime when stored .
