Gerorianischer Kalender wechselt am Freitag die Woche Warum

Bitte aktiviere JavaScript!
Nicht nur das die Wochenzahlen falsch sind, er wechselt auch am Freitag die Woche.
Wie kann ich ihm sagen das Montag die Woche beginnt ?

Folgender Code:

Code:
        GregorianCalendar gc = new GregorianCalendar(); 
            System.out.println("first day : " + gc.getFirstDayOfWeek());
        gc.setFirstDayOfWeek(GregorianCalendar.MONDAY);
        gc.set(GregorianCalendar.YEAR, 2019);
        gc.set(GregorianCalendar.MONTH, 1);
        gc.set(GregorianCalendar.DATE, 1);
        int week = gc.get(GregorianCalendar.WEEK_OF_YEAR);   
            System.out.println("Week 1.1: " + week);
        
            
        gc.set(GregorianCalendar.YEAR, 2019);
        gc.set(GregorianCalendar.MONTH, 1);
        gc.set(GregorianCalendar.DATE, 3);
        week = gc.get(GregorianCalendar.WEEK_OF_YEAR);   
            System.out.println("Week 4.1: " + week);
            
        gc.set(GregorianCalendar.YEAR, 2019);
        gc.set(GregorianCalendar.MONTH, 1);
        gc.set(GregorianCalendar.DATE, 4);
        week = gc.get(GregorianCalendar.WEEK_OF_YEAR);   
            System.out.println("Week 4.1: " + week);
              
        gc.set(GregorianCalendar.YEAR, 2019);
        gc.set(GregorianCalendar.MONTH, 1);
        gc.set(GregorianCalendar.DATE, 7);
        week = gc.get(GregorianCalendar.WEEK_OF_YEAR);   
            System.out.println("Week 7.1: " + week);
        
        gc.set(GregorianCalendar.YEAR, 2019);
        gc.set(GregorianCalendar.MONTH, 1);
        gc.set(GregorianCalendar.DATE, 8);
        week = gc.get(GregorianCalendar.WEEK_OF_YEAR);   
            System.out.println("Week 8.1: " + week);
        
        gc.set(GregorianCalendar.YEAR, 2019);
        gc.set(GregorianCalendar.MONTH, 1);
        gc.set(GregorianCalendar.DATE, 9);
        week = gc.get(GregorianCalendar.WEEK_OF_YEAR);   
            System.out.println("Week 9.1: " + week);
                    
        gc.set(GregorianCalendar.YEAR, 2019);
        gc.set(GregorianCalendar.MONTH, 1);
        gc.set(GregorianCalendar.DATE, 10);
        week = gc.get(GregorianCalendar.WEEK_OF_YEAR);   
            System.out.println("Week 10.1: " + week);
                    
        gc.set(GregorianCalendar.YEAR, 2019);
        gc.set(GregorianCalendar.MONTH, 1);
        gc.set(GregorianCalendar.DATE, 11);
        week = gc.get(GregorianCalendar.WEEK_OF_YEAR);   
            System.out.println("Week 11.1: " + week);
            
        gc.set(GregorianCalendar.YEAR, 2019);
        gc.set(GregorianCalendar.MONTH, 1);
        gc.set(GregorianCalendar.DATE, 12);
        week = gc.get(GregorianCalendar.WEEK_OF_YEAR);   
            System.out.println("Week 12.1: " + week);
        
        gc.set(GregorianCalendar.YEAR, 2019);
        gc.set(GregorianCalendar.MONTH, 1);
        gc.set(GregorianCalendar.DATE, 13);
        week = gc.get(GregorianCalendar.WEEK_OF_YEAR);   
            System.out.println("Week 13.1: " + week);
        
        gc.set(GregorianCalendar.YEAR, 2019);
        gc.set(GregorianCalendar.MONTH, 1);
        gc.set(GregorianCalendar.DATE, 14);
        week = gc.get(GregorianCalendar.WEEK_OF_YEAR);   
            System.out.println("Week 14.1: " + week);
                    
        gc.set(GregorianCalendar.YEAR, 2019);
        gc.set(GregorianCalendar.MONTH, 1);
        gc.set(GregorianCalendar.DATE, 15);
        week = gc.get(GregorianCalendar.WEEK_OF_YEAR);   
            System.out.println("Week 15.1: " + week);
                    
        gc.set(GregorianCalendar.YEAR, 2019);
        gc.set(GregorianCalendar.MONTH, 1);
        gc.set(GregorianCalendar.DATE, 16);
        week = gc.get(GregorianCalendar.WEEK_OF_YEAR);   
            System.out.println("Week 16.1: " + week);
        
        gc.set(GregorianCalendar.YEAR, 2019);
        gc.set(GregorianCalendar.MONTH, 1);
        gc.set(GregorianCalendar.DATE, 17);
        week = gc.get(GregorianCalendar.WEEK_OF_YEAR);   
            System.out.println("Week 17.1: " + week);
                    
        gc.set(GregorianCalendar.YEAR, 2019);
        gc.set(GregorianCalendar.MONTH, 1);
        gc.set(GregorianCalendar.DATE, 18);
        week = gc.get(GregorianCalendar.WEEK_OF_YEAR);   
            System.out.println("Week 18.1: " + week);
                    
        gc.set(GregorianCalendar.YEAR, 2019);
        gc.set(GregorianCalendar.MONTH, 1);
        gc.set(GregorianCalendar.DATE, 19);
        week = gc.get(GregorianCalendar.WEEK_OF_YEAR);   
            System.out.println("Week 19.1: " + week);

Bei mir kommt folgendes raus, darauf kann ich mir keinen Reim machen.

first day : 2
Week 1.1: 5
Week 4.1: 5
Week 4.1: 6
Week 7.1: 6
Week 8.1: 6
Week 9.1: 6
Week 10.1: 6
Week 11.1: 7
Week 12.1: 7
Week 13.1: 7
Week 14.1: 7
Week 15.1: 7
Week 16.1: 7
Week 17.1: 7
Week 18.1: 8
Week 19.1: 8
 
A

Anzeige




Schau mal hier —> (hier klicken)
Bitte ließ die Dokumentation von GregorianCalendar und Calendar, insbesondere von MONTH.
Heißt:
Java:
gc.set(GregorianCalendar.YEAR, 2019);
gc.set(GregorianCalendar.MONTH, 1);
gc.set(GregorianCalendar.DATE, 4);
Setzt den Kalender auf den 04.02.2019, was ein Montag war!
 
A

Anzeige




Vielleicht hilft dir das hier weiter: (klicke hier)
Passende Stellenanzeigen aus deiner Region:

Neue Themen

Oben