Calendar properties

In this chapter you will learn:

  1. whether date/time interpretation is to be lenient
  2. Get the available locales

Lenient date/time

boolean isLenient() tells whether date/time interpretation is to be lenient.

import java.util.Calendar;
/* j a  v  a2  s  .com*/
public class Main{
  public static void main(String[] argv){
      System.out.println(Calendar.getInstance().isLenient());
  }
}

The output:

Get the available locales

static Locale[] getAvailableLocales() returns an array of all locales for which the getInstance methods of this class can return localized instances.

The following code displays all locales from Calendar class:

import java.util.Calendar;
import java.util.Locale;
/*from   ja v  a 2  s. c o  m*/
public class Main{
  public static void main(String[] argv){
    Locale[] locales = Calendar.getAvailableLocales();
    for(Locale l: locales){
      System.out.println(l.getDisplayCountry());
    }
  }
}

The output:

Next chapter...

What you will learn in the next chapter:

  1. Get to know GregorianCalendar class
  2. A demo to show how to use GregorianCalendar
Home » Java Tutorial » Date, Time, Calendar, TimeZone

Date

    Date class
    Date comparison
    Converting date value
    DateFormat class
    Format time
    DateFormat and Locale
    Convert String to Date

Calendar

    Calendar class
    Calendar date time getter
    Calendar set hour,minute,second
    Calendar calculation
    Calendar comparison
    Calendar properties
    GregorianCalendar

TimeZone

    TimeZone
    TimeZone ID and display name
    TimeZone daylight saving

DateFormat

    DateFormat class
    Format time
    DateFormat and Locale
    Convert String to Date
    SimpleDateFormat
    Parse date string into Date object
    SimpleDateFormat day format
    SimpleDateFormat Hour Time format
    SimpleDateFormat format minute
    SimpleDateFormat to format month
    SimpleDateFormat to format second value
    SimpleDateFormat to format TimeZone
    SimpleDateFormat to format year
    SimpleDateFormat to combine formatting flags