Java tutorial
//package com.java2s; import java.text.ParsePosition; import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; public class Main { /** * Parse the Date String in mySQL format into date object * * @param SQLDate the date String in SQL format ("yyyy-MM-dd HH:mm:ss") * @return The date object corresponding to SQLDate */ public static Date parseSQLDate(String SQLDate) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); sdf.setTimeZone(TimeZone.getTimeZone("GMT")); return sdf.parse(SQLDate, new ParsePosition(0)); } }