您可以使用带有所需时区的dateformat并将其应用于日期
public Date convertToZone(Date date, String tz) { DateFormat TFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); TFormat.setTimeZone(TimeZone.getTimeZone(tz)); return df.parse(currentTFormat.format(date));}
您可以使用带有所需时区的dateformat并将其应用于日期
public Date convertToZone(Date date, String tz) { DateFormat TFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); TFormat.setTimeZone(TimeZone.getTimeZone(tz)); return df.parse(currentTFormat.format(date));}