Question: how to convert string to date in java in yyyy-mm-dd hh mm ss format?
Answer: Date date = Calendar.getInstance().getTime(); DateFormat dateFormat = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss"); String strDate = dateFormat.format(date);