【发布时间】:2011-07-04 10:48:25
【问题描述】:
所以我将当前时间转换为UTC时间格式的代码如下:
Date currentDate = Calendar.getInstance().getTime();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd kk:mm:ss");
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
String UTCTime= sdf.format(currentDate);
但由于某种原因它不起作用,它仍然在我的时区而不是 UTC 时区给出当前时间。有谁知道是什么原因造成的?
【问题讨论】: