Here you can find the source of timestamp2Date(long timestamp, String timezone)
public static Date timestamp2Date(long timestamp, 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 { private static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss"; public static Date timestamp2Date(long timestamp, String timezone) throws ParseException { SimpleDateFormat dateFormatGmt = new SimpleDateFormat(DATE_FORMAT); dateFormatGmt.setTimeZone(TimeZone.getTimeZone(timezone)); SimpleDateFormat dateFormatLocal = new SimpleDateFormat(DATE_FORMAT); return dateFormatLocal.parse(dateFormatGmt.format(new Date(timestamp))); }/*from w ww . ja va 2 s .c o m*/ }