Pages

Sunday, 20 November 2016

Problem 33 - Zona Waktu

  1. import java.util.Calendar;
  2. import java.util.TimeZone;
  3.  
  4. public class GetCurrentTimeZone {
  5.  
  6.   public static void main(String[] args) {
  7.    
  8.     //get Calendar instance
  9.     Calendar now = Calendar.getInstance();
  10.    
  11.     //get current TimeZone using getTimeZone method of Calendar class
  12.     TimeZone timeZone = now.getTimeZone();
  13.    
  14.     //display current TimeZone using getDisplayName() method of TimeZone class
  15.     System.out.println("Current TimeZone is : " + timeZone.getDisplayName());
  16.   }
  17. }

0 comments:

Post a Comment