public static void main(String[] args) {
        Calendar calendar = Calendar.getInstance();
         calendar.set(Calendar.HOUR_OF_DAY, calendar.get(Calendar.HOUR_OF_DAY) - 10);
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        System.out.println("一个小时前:" + df.format(calendar.getTime()));
        System.out.println("当前的时间:" + df.format(new Date()));

    }

 

相关文章:

  • 2021-08-20
  • 2021-06-10
  • 2022-12-23
  • 2021-10-27
  • 2022-12-23
  • 2022-12-23
  • 2021-07-19
  • 2022-12-23
猜你喜欢
  • 2021-11-17
  • 2022-12-23
  • 2022-12-23
  • 2021-12-30
  • 2021-06-04
  • 2021-09-22
  • 2022-12-23
相关资源
相似解决方案