public static Date stringToDate(String str) { DateFormat format = new SimpleDateFormat("yyyy-MM-dd"); Date date = null; try { // Fri Feb 24 00:00:00 CST 2012 date = format.parse(str); } catch (ParseException e) { e.printStackTrace(); } // 2012-02-24 date = java.sql.Date.valueOf(str); return date; }
Date startDate=stringToDate(startTime);
Java:String转换为date类型,布布扣,bubuko.com
原文:http://blog.csdn.net/gisredevelopment/article/details/28659867