How to get week day of persian calendar in java
I want to set up a function to get the first day and the last day of the Persian year and display it in a list for weeks, and do it with a Gregorian date to pass to the function. I want to use this code on Android Studios.
Example
public class Week {
public String start_date;
public String end_date;
}
public list GetWeek(Date date) {
//return list
// start_date = 1396-01-01 ;
// end_date = 1396-01-07;
//......
// And by the end of the year like that
}
I also used the Persian Calendar library, but it does not work in the loop
Code
CurrentPersianDate = new PersianDate();
NextPersianDate = new PersianDate();
CurrentPersianDate.setShYear(1396);
CurrentPersianDate.setShDay(1);
CurrentPersianDate.setShMonth(1);
NextPersianDate.setShYear(1397);
NextPersianDate.setShDay(1);
NextPersianDate.setShMonth(1);
while (CurrentPersianDate.before(NextPersianDate)) {
CurrentPersianDate.addWeek(1);
LOG(CurrentPersianDate.getShYear() + " " + CurrentPersianDate.getShMonth() + " " +
CurrentPersianDate.getShDay() , "");
}