关于时间的操作(Java版)——获取给定时间与现阶段系统时间的差值(以毫秒为单位)

关于时间的操作(Java版)——获取给定时间与当前系统时间的差值(以毫秒为单位)
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Test {

	/**
	 * 获取给定时间与当前系统时间的差值(以毫秒为单位)
	 * 
	 * @author GaoHuanjie
	 */
	public long getTimeDifference(String paramTime) {
		DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		String systemTime = new SimpleDateFormat("yyyy-MM-dd kk:mm:ss").format(new Date().getTime());// 获取系统时间
		long difference = 0;
		try {
			Date systemDate = dateFormat.parse(systemTime);
			Date lockDate = dateFormat.parse(paramTime);
			difference = systemDate.getTime() - lockDate.getTime();
			System.out.println("系统时间:" + systemTime + ",给定时间:" + paramTime 	+ ",给定时间与当前系统时间的差值(以毫秒为单位):" + difference + "毫秒");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return difference;
	}

	public static void main(String[] args) {
		new Test().getTimeDifference("2014-06-04 14:48:47");
	}
}