Here you can find the source of parseDateToLongString(String dateString)
public static String parseDateToLongString(String dateString)
import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import android.annotation.SuppressLint; public class Main{ private static final String FORMAT_DATE_AND_TIME_YYYY_MM_DD_HH_MM = "yyyy-MM-dd HH:mm"; public static String parseDateToLongString(String dateString) { if (StringUtils.isEmpty(dateString)) { return ""; }/*from w ww .jav a 2 s . com*/ Long dateLong = parseDateToLong(dateString); if (dateLong == null) { return null; } else { return String.valueOf(dateLong); } } public static Long parseDateToLong(String dateString) { if (StringUtils.isEmpty(dateString) || dateString.equals("0")) { return 0L; } Date date = parseDate(dateString); if (date == null) { return null; } else { return date.getTime(); } } public static Date parseDate(String dateString) { SimpleDateFormat sdf = new SimpleDateFormat( FORMAT_DATE_AND_TIME_YYYY_MM_DD_HH_MM); try { return sdf.parse(dateString); } catch (Exception e) { e.printStackTrace(); return null; } } }