有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java为什么是DateFormat。格式(日期),给出与日期不同的时间。toString()?

我在代码中观察到这种奇怪的行为-

Date executionDate = execDao.getExecutionDate(id);
System.out.println(executionDate);

SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
System.out.println(dateFormat.format(executionDate));

这就给出了输出

2014-03-05 22:10:46.0
2014-03-05 10:10:46

为什么输出的小时数不同


共 (1) 个答案