Java tutorial
//package com.java2s; //License from project: Apache License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; public class Main { public static SimpleDateFormat mAuthFormat; public static Date getAuthDate(String dataString) { try { if (dataString == null || dataString.isEmpty()) { return null; } return getAuthFormat().parse(dataString); } catch (Exception ex) { return null; } } public static DateFormat getAuthFormat() { if (mAuthFormat == null) { mAuthFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss 'EST' yyyy"); mAuthFormat.setTimeZone(TimeZone.getTimeZone("GMT")); } return mAuthFormat; } }