Java tutorial
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class Main { public static Date getDateTime(String dateTime) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.getDefault()); Date date = null; try { date = dateFormat.parse(dateTime); } catch (ParseException e) { e.printStackTrace(); } return date; } }