为了账号安全,请及时绑定邮箱和手机立即绑定

将WallClock时间从一个时区转换为另一个时区

将WallClock时间从一个时区转换为另一个时区

Smart猫小萌 2021-04-28 13:38:58
我想将挂钟时间从一个TZ转换为另一个TZ,而无需自己进行偏移数学计算。    SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss z");    String d = sdf.format(new Date());    System.out.println(d);    sdf.setTimeZone(TimeZone.getTimeZone("America/New_York"));    String d1 = sdf.format(new Date());    System.out.println(d1);输出:2018.07.09 13:43:30 PDT2018.07.09 16:43:30 EDT期望的输出2018.07.09 13:43:30 PDT2018.07.09 13:43:30 EDT如何获得所需的输出?
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 122 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信