简体   繁体   中英

Conversion of Date into string in java when storing in database

there is a value object processVO having date variable of string type in it( with getter & setter) .I am trying to populate it in in my DAO class in following way:- PreparedStatement.setString(processVO.getDate);
It is giving me an error as:- cannot convert Date type into String. //the value stored in processVO.getDate() is having date & time both ie "2-apr-2013 1:20 am"

这不应该被认为是一个好习惯,但是在简单检索字符串的情况下,您可以在processVO.getDate()上使用toString()方法,例如

processVO.getDate().toString()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM