Here you can find the source of stringToDate(String date)
public static Date stringToDate(String date) throws ParseException
//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 { private static SimpleDateFormat formatter = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss"); public static Date stringToDate(String date) throws ParseException { formatter.setTimeZone(TimeZone.getTimeZone("gmt")); return (formatter.parse(date)); }/* ww w. j ava 2 s . c o m*/ }