Java tutorial
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; public class Main { public static String changeStringToDate1(String str) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); java.util.Date date6 = null; try { date6 = sdf.parse(str); return date6.toString(); } catch (ParseException e) { e.printStackTrace(); return ""; } } }