How to get date datatype from sql database to java?

∥☆過路亽.° 提交于 2019-11-28 14:36:44

You have two options.
1 - Take sql date object and construct utils date using the getTime method of sql date
or
2 - call getTimeStamp instead of getDate , It will return object of sql timeStamp class that is actually child class of java.util.Date

1 -  Date d1 = new Date(rs.getDate("date_time").getTime());
2 -  Date d2 = rs.getTimestamp("date_time");

If combo box is not allowing object to inserted, while adding it to the combo_box use d_time.toString() method.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!