Java tutorial
import java.text.DateFormat; import java.text.ParseException; import java.util.Date; import java.util.TimeZone; public class Util { public static long getLocalEpoch(TimeZone timezone) { DateFormat dateFormat = DateFormat.getInstance(); if (timezone != null) dateFormat.setTimeZone(timezone); long result = 0; try { result = DateFormat.getInstance().parse("01/02/70 12:00 AM").getTime(); } catch (ParseException e) { } if (dateFormat.getTimeZone().inDaylightTime(new Date())) { result -= 60 * 60 * 1000; } return result; } }