Java tutorial
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String ymd2Timestamp(String dateString) throws ParseException { String timeStamp = null; SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd"); Date d; try { d = sdf.parse(dateString); long l = d.getTime() / 1000; timeStamp = String.valueOf(l); } catch (ParseException e) { e.printStackTrace(); } return timeStamp; } }