Here you can find the source of string2Timestamp(String dateString, String timezone)
public static long string2Timestamp(String dateString, String timezone) throws ParseException
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; public class Main { public static long string2Timestamp(String dateString, String timezone) throws ParseException { SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); if ((timezone != null) && (!timezone.equals(""))) { df.setTimeZone(TimeZone.getTimeZone(timezone)); }/*from w ww . j a v a 2 s . c o m*/ Date date1 = df.parse(dateString); long temp = date1.getTime(); return temp; } }