Java tutorial
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; public class Main { public static Date getDateFromString(String inputString) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); sdf.setTimeZone(TimeZone.getTimeZone("UTC")); Date date = null; try { date = sdf.parse(inputString); } catch (ParseException e) { e.printStackTrace(); } return date; } }