将Long类型的毫秒数转换成时间格式

来源:互联网 发布:网络节目排行榜 编辑:程序博客网 时间:2024/05/01 18:01
public String getStandardTime(long timestamp) {SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss",Locale.getDefault());sdf.setTimeZone(TimeZone.getTimeZone("GMT+0"));Date date = new Date(timestamp+8*60*60*1000);sdf.format(date);return sdf.format(date);}

long curtime = System.currentTimeMillis();
String curString = getStandardTime(curtime);
0 0