arjacsoh
arjacsoh

Reputation: 9232

Locale in method Calendal.getInstance(Locale aLocale)

What is the role of Locale in the method specified in question title? How does it affect any results? I am trying the following two lines of code:

Calendar cal = Calendar.getInstance();
System.out.println(cal.getTime().toString());

I receive the same result even if I try it with the parameter Locale.GERMANY or Locale.ITALY. When does it affect actually the result?

Upvotes: 0

Views: 208

Answers (2)

T A
T A

Reputation: 1

Well, I'm going with Locale.GERMANY and Locale.ITALY having the same time.

Try comparing Locale.CANADA with Locale.GERMANY

Upvotes: 0

kosa
kosa

Reputation: 66637

It will be useful when you do calls like first day of week etc., when you do getTime() you may not see any difference.

As per javadoc

Calendar defines a locale-specific seven day week using two parameters: the first day of the week and the minimal days in first week (from 1 to 7). These numbers are taken from the locale resource data when a Calendar is constructed.

Upvotes: 5

Related Questions