SimpleDateFormat sdformat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//HH表示24小时制,hh表示12小时制。
sdformat.setTimeZone(TimeZone.getTimeZone("GMT+08:00"));//加上这行代码解决时区导致时间不准确的问题。
Date date=new Date(System.currentTimeMillis());
String time=sdformat.format(date);
回答评级:★★★☆☆☆☆☆☆ 回答者:{yund98}yund98 9-16
回答