【发布时间】:2012-12-06 18:06:15
【问题描述】:
【问题讨论】:
标签: java date datetime timezone dst
【问题讨论】:
标签: java date datetime timezone dst
你想这样做
Date date = new Date();
DateFormat formatter = new SimpleDateFormat("dd MMM yyyy HH:mm:ss z");
formatter.setTimeZone(TimeZone.getTimeZone("CET"));
// Prints the date in the CET timezone
System.out.println(formatter.format(date));
// Set the formatter to use a different timezone
formatter.setTimeZone(TimeZone.getTimeZone("IST"));
// Prints the date in the IST timezone
System.out.println(formatter.format(date));
【讨论】: