Hi,
I'm trying to understand how the Calendar, GregorianCalendar and Locale classes work.
Say I instantiate two Locale objects and then two Calendar objects, each with their respective Locale.
Then ask for the always troublesome DAY_OF_WEEK on every Calendar object as in the following code:
import java.util.Calendar;
import java.util.Calendar.*;
import java.util.*;
class Calendario {
public static void main(String[] args) {
Locale there = new Locale("ENGLISH", "US");
Locale here = new Locale("GERMAN", "DE");
GregorianCalendar gCalThere = new GregorianCalendar(there);
GregorianCalendar gCalHere = new GregorianCalendar(here);
System.out.println("Day of week today there: " + gCalThere.get(GregorianCalendar.DAY_OF_WEEK));
System.out.println("Day of week today here: " + gCalHere.get(GregorianCalendar.DAY_OF_WEEK));
}
}
The output is the following:
Day of week there: 4
Day of week here: 4
Being today wednesday, I'd have thougth "Day of week here" should be "3".
Why isnt'? How can I properly change Locale and display the correct day of the week?
Thanks in advance.