时间戳错误的时间

时间:2013-12-05 17:52:47

标签: android time timestamp

我想获得时间戳时间:

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 怎么了?

1 个答案:

答案 0 :(得分:2)

可能因为您的设备Time Zone,请检查您的Time Zone(GMT+HH:MM)

相关问题