Java tutorial
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String getTimeStamp(String str) { long stamp = 0; SimpleDateFormat dfs = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); try { Date date = dfs.parse(str); stamp = date.getTime(); } catch (Exception e) { e.printStackTrace(); } return stamp + ""; } }