Here you can find the source of parseLong(final String s, final String fmt)
public static long parseLong(final String s, final String fmt)
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static final SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); public static long parseLong(final String s, final String fmt) { SimpleDateFormat sdf = new SimpleDateFormat(fmt); try {//from ww w . j a va2s. com Date t = sdf.parse(s); return t == null ? 0L : t.getTime(); } catch (ParseException e) { } return 0L; } public static long parseLong(final String s) { try { Date t = sdf1.parse(s); return t == null ? 0L : t.getTime(); } catch (ParseException e) { } return 0L; } public static Date parse(final String s, final String fmt) { SimpleDateFormat sdf = new SimpleDateFormat(fmt); try { return sdf.parse(s); } catch (ParseException e) { } return null; } public static Date parse(final String s) { try { return sdf1.parse(s); } catch (ParseException e) { } return null; } }