Here you can find the source of getTimeWithStr(String source, String pattern)
public static long getTimeWithStr(String source, String pattern) throws Exception
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static long getTimeWithStr(String source, String pattern) throws Exception { return new SimpleDateFormat(pattern).parse(source).getTime(); }//from w w w . j ava 2 s . c o m public static Date parse(String DateStr) throws Exception { return new SimpleDateFormat("yyyyMMdd").parse(DateStr); } }