Java tutorial
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; public class Main { public static Date convertStrToDate(String dateStr) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS"); dateFormat.setTimeZone(TimeZone.getTimeZone("GMT+0000")); Date date = null; try { date = dateFormat.parse(dateStr); } catch (Exception e) { date = null; } return date; } }