Java tutorial
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.TimeZone; public class Main { public static String StampToyyyyMMdd(long stamp) { Date date = null; Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(stamp); date = calendar.getTime(); String format = "yyyy-MM-dd"; SimpleDateFormat sdf = new SimpleDateFormat(format); //sdf.setTimeZone(TimeZone.getTimeZone("UTC")); sdf.setTimeZone(TimeZone.getTimeZone("PRC")); return sdf.format(date); } }