书单推荐:成为Java顶级程序员架构师 ,这20来本(高薪)必看点击获取
import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.util.TimeZone; public class Test { public static void main(String[] args) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); long t = System.currentTimeMillis(); t = t / (1000 * 3600 * 24) * (1000 * 3600 * 24); System.out.println(sdf.format(new Timestamp(t))); t = System.currentTimeMillis(); t = t / (1000 * 3600 * 24) * (1000 * 3600 * 24) - TimeZone.getDefault().getRawOffset(); System.out.println(sdf.format(new Timestamp(t))); } }
转载请注明:谷谷点程序 » Java Timestamp得到00:00:00格式的时分秒