java mysql 时间不对_java 查数据库时间不对

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有什么问题还是什么。。

补充:

fa7efd056816e84a7c1e8235b2611a06.png7454ad2214769623fd0172e784eb727e.png

这一条数据数据库里是9:45:32

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值