【问题标题】:Timestamp give wrong time时间戳给出错误的时间
【发布时间】: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 怎么了?

【问题讨论】:

  • 您确定您使用的时区正确吗?

标签: android time timestamp


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-08-21
    • 1970-01-01
    • 2010-12-03
    • 1970-01-01
    • 2021-11-23
    • 2014-08-20
    • 1970-01-01
    • 2019-10-20
    相关资源
    最近更新 更多