0

我正在尝试使用 Jalali 日历获取给定月份的周末日期。但我不起作用。我用这个这个解决方案来解决它,但是当我改变月份时我得到了相同的结果

public static void main(String[] args) {
        ULocale locale = new ULocale("@calendar=persian");
        Calendar cal = Calendar.getInstance(locale);
        cal.setFirstDayOfWeek(7); //Make Saturdays first day of the week.
        cal.set(Calendar.YEAR,1398);
        cal.set(Calendar.MONTH,10);
        cal.set(Calendar.DATE,1);


        do {
            // get the day of the week for the current day
            int day = cal.get(Calendar.DAY_OF_WEEK);
            // check if it is a Saturday or Sunday
            if (day == Calendar.FRIDAY) {//Friday is Weekend in Jalali Calendar

                System.out.println(cal.get(Calendar.DAY_OF_MONTH));
            }
            // advance to the next day
            cal.add(Calendar.DAY_OF_YEAR, 1);
        }  while (cal.get(Calendar.MONTH) == 10);




    }

任何帮助,将不胜感激

4

0 回答 0