标签(空格分隔): java

SimpleDateFormat

H:一天中的小时数:0-23
h: am/pm 小时数: 1-12

public void doPost() {
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
    SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String format = simpleDateFormat.format(new Date());
    String format2 = simpleDateFormat2.format(new Date());
    System.out.println(format);
    System.out.println(format2);
}

SimpleDateFormat 格式化时间少了12个小时

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-23
  • 2021-11-07
  • 2022-12-23
  • 2022-12-23
  • 2021-11-11
  • 2022-12-23
  • 2022-01-17
相关资源
相似解决方案