Java tutorial
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static long changeToTimeStamp(String time) { long rand = 0; try { Date date1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(time + " 00:00:00"); rand = date1.getTime(); return rand; } catch (ParseException e) { e.printStackTrace(); } return rand; } }