⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 worldtime.java

📁 Java经典例程 从外国一大学计算机教授出版物下载的代码 经典
💻 JAVA
字号:
import java.util.*;

class WorldTime {

  /* Time Zone program   by J M Bishop December 1997
   * -----------------   Java 1.1
   *                     updated July 2000
   * Uses the Java libraries to display
   * time anywhere in the world.
   */

  public static void main (String [ ] args) {
    new WorldTime();
  }

  WorldTime() {
     TimeZone here = TimeZone.getDefault();
     Date today = new Date();
     System.out.println(today);
     System.out.println("We are in " + here.getID() + " time zone");
     System.out.println("with " + here.getRawOffset()/3600000 +
                        " offset from UTC");

     System.out.println("Daylight Savings Time used here is " +
                       here.useDaylightTime());
     System.out.println("and being now in Daylight Savings Time is "
                       + here.inDaylightTime(today));

  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -