Java Date Time - Java Calendar.getInstance(Locale aLocale)








Syntax

Calendar.getInstance(Locale aLocale) has the following syntax.

public static Calendar getInstance(Locale aLocale)

Example

In the following code shows how to use Calendar.getInstance(Locale aLocale) method.

//from  ww  w .j av  a  2  s . c  o  m

import java.util.Calendar;
import java.util.Locale;

public class Main {

   public static void main(String[] args) {
      
      Calendar cal = Calendar.getInstance(Locale.CANADA);

      // print the date for canada 
      System.out.println("Date And Time in Canada Is: " + cal.getTime());
   }
}

The code above generates the following result.