Here you can find the source of getTimestamp(String timezone, String dateTime, String pattern)
public static long getTimestamp(String timezone, String dateTime, String pattern) throws ParseException
//package com.java2s; /*//from w ww.j a va2 s .c o m * Commons-Utils * Copyright (c) 2017. * * Licensed under the Apache License, Version 2.0 (the "License") */ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.TimeZone; public class Main { public static final String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; public static long getTimestamp(String timezone, String dateTime, String pattern) throws ParseException { SimpleDateFormat sdf = null; if (null == pattern || "".equals(pattern)) { sdf = new SimpleDateFormat(YYYY_MM_DD_HH_MM_SS); } else { sdf = new SimpleDateFormat(pattern); } sdf.setTimeZone(TimeZone.getTimeZone(timezone)); long b = sdf.parse(dateTime).getTime() / 1000; return b; } }