---
title: "获取当前系统北京时区的时间"
author: "wenlong342"
date: "2008-01-11T14:43:10Z"
tags: []
slug: "untitled"
draft: false
lastmod: "2008-01-11T14:43:10Z"
id: 157187
url: "https://wenlong.iteye.com/blog/157187"
---

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);