ITeye博客

获取当前系统北京时区的时间

wenlong342 · 2008-01-11 14:43 · java · Markdown

import java.util.Date 

Date time=new Date();
  DateFormat gmt08Formatter=DateFormat.getDateTimeInstance();
  TimeZone timezone=TimeZone.getTimeZone("GMT+08:00");
  gmt08Formatter.setTimeZone(timezone);
//  获得格式化后的东八区时间
  String gmt08DateTime=gmt08Formatter.format(time);

System.out.println(gmt08DateTime);

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。