【发布时间】:2013-12-22 19:35:19
【问题描述】:
我想获取时间戳时间:
Timestamp stamp = new Timestamp(time);
Date date = new Date(stamp.getTime());
SimpleDateFormat sdf = new SimpleDateFormat("h:mm:ss a", Locale.US);
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
String formattedDate = sdf.format(date);
但它工作错了。当它是 20:50 时,它显示 11:50 AM 怎么了?
【问题讨论】:
-
您确定您使用的时区正确吗?