Here you can find the source of ToTimestamp(String user_time)
public static String ToTimestamp(String user_time)
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String ToTimestamp(String user_time) { String re_time = null;/*from w ww . ja v a 2 s . c o m*/ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); Date d; try { d = sdf.parse(user_time); long l = d.getTime(); String str = String.valueOf(l); re_time = str.substring(0, 10); } catch (ParseException e) { e.printStackTrace(); } return re_time; } }