想要把格式为yyyy-mm-dd HH:mm:ss 的字符串格式转换成Timestamp类型格式为yyyy-mm-dd HH:mm:ss 的
请教一下高手怎么转
例如: String time="2010-01-01 23:59:59";
转换成Timestamp timestamp=="2010-01-01 23:59:59";
请教一下高手怎么转
例如: String time="2010-01-01 23:59:59";
转换成Timestamp timestamp=="2010-01-01 23:59:59";
用Timestamp.valueOf()转换出来的日期格式都是yyyy-mm-dd HH:mm:ss.0 我在postgres数据库查询时日期格式对不上
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try
{
Date date = sdf.parse(str);
ts = new Timestamp(date.getTime());
}
catch (ParseException e)
{
e.printStackTrace();
}