集册 Java实例教程 使用日历获取当前时区

使用日历获取当前时区

欢马劈雪     最近更新时间:2020-01-02 10:19:05

454
提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
使用日历获取当前时区

 

import java.util.Calendar;

import java.util.TimeZone;
/** 
来 自 
NowJava.com - 时  代  Java
**/

 

public class Main {

 

  public static void main(String[] args) {

   

    Calendar now = Calendar.getInstance();

   

    TimeZone timeZone = now.getTimeZone();

   

    System.out.println("Current TimeZone is : " + timeZone.getDisplayName());

  }

}/* 来 自 时代Java - nowjava.com*/