cars表里有如下数据:
mysql> select * from cars;
+------+--------+--------+---------------------+---------------------+
| id | name | vendor | ctime | utime |
+------+--------+--------+---------------------+---------------------+
| 801 | China1 | China | 2019-05-07 09:45:32 | 2019-05-07 09:45:32 |
| 802 | China2 | China | 2019-05-07 09:45:37 | 2019-05-07 09:45:37 |
| 803 | Japan | Japan | 2019-05-07 09:45:37 | 2019-05-07 09:45:37 |
| 1001 | China1 | China | 2019-05-07 10:18:21 | 2019-05-07 10:18:21 |
| 1002 | China2 | China | 2019-05-07 10:18:22 | 2019-05-07 10:18:22 |
| 1003 | Japan | Japan | 2019-05-07 10:18:22 | 2019-05-07 10:18:22 |
| 1004 | China1 | China | 2019-05-07 10:18:56 | 2019-05-07 10:18:56 |
| 1005 | China2 | China | 2019-05-07 10:18:56 | 2019-05-07 10:18:56 |
| 1006 | Japan | Japan | 2019-05-07 10:18:56 | 2019-05-07 10:18:56 |
| 1201 | China1 | China | 2019-05-07 10:49:44 | 2019-05-07 10:49:44 |
| 1202 | China2 | China | 2019-05-07 10:49:44 | 2019-05-07 10:49:44 |
| 1203 | Japan | Japan | 2019-05-07 10:49:44 | 2019-05-07 10:49:44 |
+------+--------+--------+---------------------+---------------------+
12 rows in set (0.00 sec)
java中执行查询,
SELECT * FROM cars WHERE vendor='China'
根据resultSet遍历获取各列的值,ctime和utime和数据库里的有差别。
[
{
utime: "2019-05-07 10:45:32",
vendor: "China",
name: "China1",
ctime: "2019-05-07 10:45:32",
id: 801
},
{
utime: "2019-05-07 10:45:37",
vendor: "China",
name: "China2",
ctime: "2019-05-07 10:45:37",
id: 802
},
{
utime: "2019-05-07 11:18:21",
vendor: "China",
name: "China1",
ctime: "2019-05-07 11:18:21",
id: 1001
},
{
utime: "2019-05-07 11:18:22",
vendor: "China",
name: "China2",
ctime: "2019-05-07 11:18:22",
id: 1002
},
{
utime: "2019-05-07 11:18:56",
vendor: "China",
name: "China1",
ctime: "2019-05-07 11:18:56",
id: 1004
},
{
utime: "2019-05-07 11:18:56",
vendor: "China",
name: "China2",
ctime: "2019-05-07 11:18:56",
id: 1005
},
{请大佬们看看问题在哪,是resultSet.getObject有什么问题还是什么。。
补充:
这一条数据数据库里是9:45:32