Java Code Examples for org.joda.time.LocalDate#getMonthOfYear()

The following examples show how to use org.joda.time.LocalDate#getMonthOfYear() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PhdGratuityPaymentPeriod.java    From fenixedu-academic with GNU Lesser General Public License v3.0 6 votes vote down vote up
public Money fine(double fineRate, Money amount, DateTime when) {
    LocalDate whenPaying = new LocalDate(when.getYear(), when.monthOfYear().get(), when.dayOfMonth().get());
    LocalDate lastPaymentDay = new LocalDate(when.getYear(), getMonthLastPayment(), getDayLastPayment());

    if (whenPaying.isAfter(lastPaymentDay)) {
        int monthsOut = when.getMonthOfYear() - lastPaymentDay.getMonthOfYear();

        // if is in the same month, and a day has passed, at least it
        // counts for one month
        if (monthsOut == 0) {
            monthsOut = 1;
        }
        return new Money(amount.getAmount().multiply(new BigDecimal(fineRate * monthsOut)));
    } else {
        return new Money(0);
    }
}
 
Example 2
Source File: LocalDatePeriodCountCalculator.java    From objectlabkit with Apache License 2.0 6 votes vote down vote up
private int diff360EIsda(final LocalDate start, final LocalDate end) {
    if (start.equals(end)) {
        return 0;
    }
    int dayStart = start.getDayOfMonth();
    int dayEnd = end.getDayOfMonth();

    if (start.dayOfMonth().getMaximumValue() == dayStart) {
        dayStart = CalculatorConstants.MONTH_30_DAYS;
    }
    if (end.getMonthOfYear() != 2 && end.dayOfMonth().getMaximumValue() == dayEnd) {
        dayEnd = CalculatorConstants.MONTH_30_DAYS;
    }

    return (end.getYear() - start.getYear()) * CalculatorConstants.YEAR_360 + (end.getMonthOfYear() - start.getMonthOfYear()) * CalculatorConstants.MONTH_30_DAYS + dayEnd - dayStart;
}
 
Example 3
Source File: SixMonthAprilIterator.java    From dhis2-android-datacapture with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
protected ArrayList<DateHolder> generatePeriod() {
    ArrayList<DateHolder> dates = new ArrayList<DateHolder>();
    checkDate = new LocalDate(cPeriod);
    int counter = 0;


    while ((openFuturePeriods > 0 || currentDate.isAfter(checkDate.plusMonths(6))) && counter < 2) {
        String year = checkDate.year().getAsString();
        String yearLastPeriod = Integer.parseInt(year)+1+"";
        String label;
        String date;

        if (checkDate.getMonthOfYear() >= APR && checkDate.getMonthOfYear() <= SEP) {
            label = String.format(DATE_LABEL_FORMAT, APR_STR_LONG, SEP_STR_LONG, year);
            date = year + S1;
        } else {
            label = String.format(DATE_LABEL_FORMAT, OCT_STR_LONG +" "+ year, MAR_STR_LONG, yearLastPeriod);
            date = year + S2;
        }


        if (checkDate.isBefore(maxDate) && isInInputPeriods(date)) {
            DateHolder dateHolder = new DateHolder(date, checkDate.toString(), label);
            dates.add(dateHolder);
        }
        checkDate = checkDate.plusMonths(6);
        counter++;
    }

    Collections.reverse(dates);
    return dates;
}
 
Example 4
Source File: SixMonthIterator.java    From dhis2-android-datacapture with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
protected ArrayList<DateHolder> generatePeriod() {
    ArrayList<DateHolder> dates = new ArrayList<DateHolder>();
    checkDate = new LocalDate(cPeriod);
    int counter = 0;


    while ((openFuturePeriods > 0 || currentDate.isAfter(checkDate.plusMonths(6))) && counter < 2) {
        String year = checkDate.year().getAsString();
        String label;
        String date;

        if (checkDate.getMonthOfYear() > JUN) {
            label = String.format(DATE_LABEL_FORMAT, JUL_STR_LONG, DEC_STR_LONG, year);
            date = year + S2;
        } else {
            label = String.format(DATE_LABEL_FORMAT, JAN_STR_LONG, JUN_STR_LONG, year);
            date = year + S1;
        }

        checkDate = checkDate.plusMonths(6);
        counter++;

        if (checkDate.isBefore(maxDate) && isInInputPeriods(date)) {
            DateHolder dateHolder = new DateHolder(date, checkDate.toString(), label);
            dates.add(dateHolder);
        }
    }

    Collections.reverse(dates);
    return dates;
}
 
Example 5
Source File: QuarterYearIterator.java    From dhis2-android-datacapture with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
protected ArrayList<DateHolder> generatePeriod() {
    ArrayList<DateHolder> dates = new ArrayList<DateHolder>();
    checkDate = new LocalDate(cPeriod);
    int counter = 0;

    while ((openFuturePeriods > 0 || currentDate.isAfter(checkDate.plusMonths(3))) && counter < 4) {
        String label;
        String date;

        int cMonth = checkDate.getMonthOfYear();
        String cYearStr = checkDate.year().getAsString();

        if (cMonth < MAR) {
            date = cYearStr + Q1;
            label = String.format(DATE_LABEL_FORMAT, JAN_STR, MAR_STR, cYearStr);
        } else if ((cMonth >= MAR) && (cMonth < JUN)) {
            date = cYearStr + Q2;
            label = String.format(DATE_LABEL_FORMAT, APR_STR, JUN_STR, cYearStr);
        } else if ((cMonth >= JUN) && (cMonth < SEP)) {
            date = cYearStr + Q3;
            label = String.format(DATE_LABEL_FORMAT, JUL_STR, SEP_STR, cYearStr);
        } else {
            date = cYearStr + Q4;
            label = String.format(DATE_LABEL_FORMAT, OCT_STR, DEC_STR, cYearStr);
        }

        if (checkDate.isBefore(maxDate) && isInInputPeriods(date)) {
            DateHolder dateHolder = new DateHolder(date, checkDate.toString(), label);
            dates.add(dateHolder);
        }

        checkDate = checkDate.plusMonths(3);
        counter++;
    }

    Collections.reverse(dates);
    return dates;
}
 
Example 6
Source File: MainActivity.java    From googlecalendar with Apache License 2.0 5 votes vote down vote up
@Override
public long getHeaderId(int position) {


    if (eventalllist.get(position).getType()==1)return position;
    else if (eventalllist.get(position).getType()==3)return position;
   else if (eventalllist.get(position).getType()==100)return position;
    else if (eventalllist.get(position).getType()==200)return position;
    LocalDate localDate=eventalllist.get(position).getLocalDate();
    String uniquestr=""+localDate.getDayOfMonth()+localDate.getMonthOfYear()+localDate.getYear();
    return Long.parseLong(uniquestr);

}
 
Example 7
Source File: MoroccoTimes.java    From prayer-times-android with Apache License 2.0 4 votes vote down vote up
protected boolean sync() throws ExecutionException, InterruptedException {
    LocalDate ldate = LocalDate.now();
    int rY = ldate.getYear();
    int Y = rY;
    int m = ldate.getMonthOfYear();
    int x = 0;

    for (int M = m; (M <= (m + 1)) && (rY == Y); M++) {
        if (M == 13) {
            M = 1;
            Y++;
        }
        String result = Ion.with(App.get())
                .load("http://www.habous.gov.ma/prieres/defaultmois.php?ville=" + getId() + "&mois=" + M)
                .userAgent(App.getUserAgent())
                .setTimeout(3000)
                .asString()
                .get();
        String temp = result.substring(result.indexOf("colspan=\"4\" class=\"cournt\""));
        temp = temp.substring(temp.indexOf(">") + 1);
        temp = temp.substring(0, temp.indexOf("<")).replace(" ", "");
        int month = Integer.parseInt(temp.substring(0, temp.indexOf("/")));
        int year = Integer.parseInt(temp.substring(temp.indexOf("/") + 1));
        result = result.substring(result.indexOf("<td>") + 4);
        result = result.replace(" ", "").replace("\t", "").replace("\n", "").replace("\r", "");
        String[] zeiten = result.split("<td>");
        for (int i = 0; i < zeiten.length; i++) {
            int day = Integer.parseInt(extract(zeiten[i]));
            String imsak = extract(zeiten[++i]);
            String gunes = extract(zeiten[++i]);
            String ogle = extract(zeiten[++i]);
            String ikindi = extract(zeiten[++i]);
            String aksam = extract(zeiten[++i]);
            String yatsi = extract(zeiten[++i]);

            LocalDate localDate = new LocalDate(year, month, day);
            setTime(localDate, Vakit.FAJR, imsak);
            setTime(localDate, Vakit.SUN, gunes);
            setTime(localDate, Vakit.DHUHR, ogle);
            setTime(localDate, Vakit.ASR, ikindi);
            setTime(localDate, Vakit.MAGHRIB, aksam);
            setTime(localDate, Vakit.ISHAA, yatsi);
            x++;
        }


    }


    return x > 25;
}
 
Example 8
Source File: BiMonthIterator.java    From dhis2-android-datacapture with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
protected ArrayList<DateHolder> generatePeriod() {
    int counter = 0;
    ArrayList<DateHolder> dates = new ArrayList<DateHolder>();
    checkDate = new LocalDate(cPeriod);

    while ((openFuturePeriods > 0 || currentDate.isAfter(checkDate.plusMonths(2))) && counter < 6) {
        int cMonth = checkDate.getMonthOfYear();
        String year = checkDate.year().getAsString();

        String date;
        String label;

        if (cMonth < FEB) {
            date = year + B1;
            label = String.format(DATE_LABEL_FORMAT, JAN_STR, FEB_STR, year);
        } else if ((cMonth >= FEB) && (cMonth < APR)) {
            date = year + B2;
            label = String.format(DATE_LABEL_FORMAT, MAR_STR, APR_STR, year);
        } else if ((cMonth >= APR) && (cMonth < JUN)) {
            date = year + B3;
            label = String.format(DATE_LABEL_FORMAT, MAY_STR, JUN_STR, year);
        } else if ((cMonth >= JUN) && (cMonth < AUG)) {
            date = year + B4;
            label = String.format(DATE_LABEL_FORMAT, JUL_STR, AUG_STR, year);
        } else if ((cMonth >= AUG) && (cMonth < OCT)) {
            date = year + B5;
            label = String.format(DATE_LABEL_FORMAT, SEP_STR, OCT_STR, year);
        } else {
            date = year + B6;
            label = String.format(DATE_LABEL_FORMAT, NOV_STR, DEC_STR, year);
        }


        if (checkDate.isBefore(maxDate) && isInInputPeriods(date)) {
            DateHolder dateHolder = new DateHolder(date, checkDate.toString(), label);
            dates.add(dateHolder);
        }

        counter++;
        checkDate = checkDate.plusMonths(2);
    }

    Collections.reverse(dates);
    return dates;
}
 
Example 9
Source File: ZoneInfoCompiler.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
DateTimeOfYear(StringTokenizer st) {
    int month = 1;
    int day = 1;
    int dayOfWeek = 0;
    int millis = 0;
    boolean advance = false;
    char zoneChar = 'w';

    if (st.hasMoreTokens()) {
        month = parseMonth(st.nextToken());

        if (st.hasMoreTokens()) {
            String str = st.nextToken();
            if (str.startsWith("last")) {
                day = -1;
                dayOfWeek = parseDayOfWeek(str.substring(4));
                advance = false;
            } else {
                try {
                    day = Integer.parseInt(str);
                    dayOfWeek = 0;
                    advance = false;
                } catch (NumberFormatException e) {
                    int index = str.indexOf(">=");
                    if (index > 0) {
                        day = Integer.parseInt(str.substring(index + 2));
                        dayOfWeek = parseDayOfWeek(str.substring(0, index));
                        advance = true;
                    } else {
                        index = str.indexOf("<=");
                        if (index > 0) {
                            day = Integer.parseInt(str.substring(index + 2));
                            dayOfWeek = parseDayOfWeek(str.substring(0, index));
                            advance = false;
                        } else {
                            throw new IllegalArgumentException(str);
                        }
                    }
                }
            }

            if (st.hasMoreTokens()) {
                str = st.nextToken();
                zoneChar = parseZoneChar(str.charAt(str.length() - 1));
                if (str.equals("24:00")) {
                    LocalDate date = (day == -1 ?
                            new LocalDate(2001, month, 1).plusMonths(1) :
                            new LocalDate(2001, month, day).plusDays(1));
                    advance = (day != -1);
                    month = date.getMonthOfYear();
                    day = date.getDayOfMonth();
                    dayOfWeek = ((dayOfWeek - 1 + 1) % 7) + 1;
                } else {
                    millis = parseTime(str);
                }
            }
        }
    }

    iMonthOfYear = month;
    iDayOfMonth = day;
    iDayOfWeek = dayOfWeek;
    iAdvanceDayOfWeek = advance;
    iMillisOfDay = millis;
    iZoneChar = zoneChar;
}
 
Example 10
Source File: Time_11_ZoneInfoCompiler_t.java    From coming with MIT License 4 votes vote down vote up
DateTimeOfYear(StringTokenizer st) {
    int month = 1;
    int day = 1;
    int dayOfWeek = 0;
    int millis = 0;
    boolean advance = false;
    char zoneChar = 'w';

    if (st.hasMoreTokens()) {
        month = parseMonth(st.nextToken());

        if (st.hasMoreTokens()) {
            String str = st.nextToken();
            if (str.startsWith("last")) {
                day = -1;
                dayOfWeek = parseDayOfWeek(str.substring(4));
                advance = false;
            } else {
                try {
                    day = Integer.parseInt(str);
                    dayOfWeek = 0;
                    advance = false;
                } catch (NumberFormatException e) {
                    int index = str.indexOf(">=");
                    if (index > 0) {
                        day = Integer.parseInt(str.substring(index + 2));
                        dayOfWeek = parseDayOfWeek(str.substring(0, index));
                        advance = true;
                    } else {
                        index = str.indexOf("<=");
                        if (index > 0) {
                            day = Integer.parseInt(str.substring(index + 2));
                            dayOfWeek = parseDayOfWeek(str.substring(0, index));
                            advance = false;
                        } else {
                            throw new IllegalArgumentException(str);
                        }
                    }
                }
            }

            if (st.hasMoreTokens()) {
                str = st.nextToken();
                zoneChar = parseZoneChar(str.charAt(str.length() - 1));
                if (str.equals("24:00")) {
                    LocalDate date = (day == -1 ?
                            new LocalDate(2001, month, 1).plusMonths(1) :
                            new LocalDate(2001, month, day).plusDays(1));
                    advance = (day != -1);
                    month = date.getMonthOfYear();
                    day = date.getDayOfMonth();
                    dayOfWeek = ((dayOfWeek - 1 + 1) % 7) + 1;
                } else {
                    millis = parseTime(str);
                }
            }
        }
    }

    iMonthOfYear = month;
    iDayOfMonth = day;
    iDayOfWeek = dayOfWeek;
    iAdvanceDayOfWeek = advance;
    iMillisOfDay = millis;
    iZoneChar = zoneChar;
}
 
Example 11
Source File: Time_11_ZoneInfoCompiler_s.java    From coming with MIT License 4 votes vote down vote up
DateTimeOfYear(StringTokenizer st) {
    int month = 1;
    int day = 1;
    int dayOfWeek = 0;
    int millis = 0;
    boolean advance = false;
    char zoneChar = 'w';

    if (st.hasMoreTokens()) {
        month = parseMonth(st.nextToken());

        if (st.hasMoreTokens()) {
            String str = st.nextToken();
            if (str.startsWith("last")) {
                day = -1;
                dayOfWeek = parseDayOfWeek(str.substring(4));
                advance = false;
            } else {
                try {
                    day = Integer.parseInt(str);
                    dayOfWeek = 0;
                    advance = false;
                } catch (NumberFormatException e) {
                    int index = str.indexOf(">=");
                    if (index > 0) {
                        day = Integer.parseInt(str.substring(index + 2));
                        dayOfWeek = parseDayOfWeek(str.substring(0, index));
                        advance = true;
                    } else {
                        index = str.indexOf("<=");
                        if (index > 0) {
                            day = Integer.parseInt(str.substring(index + 2));
                            dayOfWeek = parseDayOfWeek(str.substring(0, index));
                            advance = false;
                        } else {
                            throw new IllegalArgumentException(str);
                        }
                    }
                }
            }

            if (st.hasMoreTokens()) {
                str = st.nextToken();
                zoneChar = parseZoneChar(str.charAt(str.length() - 1));
                if (str.equals("24:00")) {
                    LocalDate date = (day == -1 ?
                            new LocalDate(2001, month, 1).plusMonths(1) :
                            new LocalDate(2001, month, day).plusDays(1));
                    advance = (day != -1);
                    month = date.getMonthOfYear();
                    day = date.getDayOfMonth();
                    dayOfWeek = ((dayOfWeek - 1 + 1) % 7) + 1;
                } else {
                    millis = parseTime(str);
                }
            }
        }
    }

    iMonthOfYear = month;
    iDayOfMonth = day;
    iDayOfWeek = dayOfWeek;
    iAdvanceDayOfWeek = advance;
    iMillisOfDay = millis;
    iZoneChar = zoneChar;
}
 
Example 12
Source File: PeriodUtil.java    From estatio with Apache License 2.0 4 votes vote down vote up
private static boolean matchesStartFinancialYear(final LocalDate date){
    return date.getDayOfMonth() == 1 && date.getMonthOfYear() == 7 ? true : false;
}
 
Example 13
Source File: TurnoverAggregationService.java    From estatio with Apache License 2.0 4 votes vote down vote up
int getMinNumberOfTurnoversToDate(final LocalDate aggregationDate){
    return aggregationDate.getMonthOfYear();
}
 
Example 14
Source File: PeriodUtil.java    From estatio with Apache License 2.0 4 votes vote down vote up
private static boolean matchesEndFinancialYear(final LocalDate date){
    return date.getDayOfMonth() == 30 && date.getMonthOfYear() == 6 ? true : false;
}
 
Example 15
Source File: MalaysiaTimes.java    From prayer-times-android with Apache License 2.0 4 votes vote down vote up
protected boolean sync() throws ExecutionException, InterruptedException {
    LocalDate ldate = LocalDate.now();
    int rY = ldate.getYear();
    int Y = rY;
    int m = ldate.getMonthOfYear();
    String[] split = getId().split("_");
    if (split.length < 2) delete();
    split[0] = URLEncoder.encode(split[0]);
    split[1] = URLEncoder.encode(split[1]);

    int x = 0;
    for (int M = m; (M <= (m + 1)) && (rY == Y); M++) {
        if (M == 13) {
            M = 1;
            Y++;
        }
        String result = Ion.with(App.get())
                .load("http://www.e-solat.gov.my/web/waktusolat.php?negeri=" + split[0] + "&state=" + split[0] + "&zone=" + split[1] + "&year="
                        + Y + "&jenis=year&bulan=" + M)
                .setTimeout(3000)
                .userAgent(App.getUserAgent())
                .asString()
                .get();
        String date = result.substring(result.indexOf("muatturun"));
        date = date.substring(date.indexOf("year=") + 5);
        int year = Integer.parseInt(date.substring(0, 4));
        date = date.substring(date.indexOf("bulan") + 6);
        int month = Integer.parseInt(date.substring(0, date.indexOf("\"")));

        result = result.substring(result.indexOf("#7C7C7C"));
        result = result.substring(0, result.indexOf("<table"));
        FOR1:
        for (result = result.substring(result.indexOf("<tr", 1));
             result.contains("tr ");
             result = result.substring(result.indexOf("<tr", 1))) {
            try {
                result = result.substring(result.indexOf("<font") + 1);
                String d = extract(result);
                if (d.startsWith("Tarikh")) continue;
                int day = Integer.parseInt(d.substring(0, 2));
                result = result.substring(result.indexOf("<font") + 1);
                result = result.substring(result.indexOf("<font") + 1);
                String imsak = extract(result);
                result = result.substring(result.indexOf("<font") + 1);
                result = result.substring(result.indexOf("<font") + 1);
                String sun = extract(result);
                result = result.substring(result.indexOf("<font") + 1);
                String ogle = extract(result);
                result = result.substring(result.indexOf("<font") + 1);
                String ikindi = extract(result);
                result = result.substring(result.indexOf("<font") + 1);
                String aksam = extract(result);
                result = result.substring(result.indexOf("<font") + 1);
                String yatsi = extract(result);

                String[] array = new String[]{imsak, sun, ogle, ikindi, aksam, yatsi};
                for (int i = 0; i < array.length; i++) {
                    array[i] = array[i].replace(".", ":");
                    if (array[i].length() == 4) array[i] = "0" + array[i];
                    if (array[i].length() != 5) continue FOR1;
                }
                LocalDate localDate = new LocalDate(year, month, day);
                setTime(localDate, Vakit.FAJR, array[0]);
                setTime(localDate, Vakit.SUN, array[1]);
                setTime(localDate, Vakit.DHUHR, array[2]);
                setTime(localDate, Vakit.ASR, array[3]);
                setTime(localDate, Vakit.MAGHRIB, array[4]);
                setTime(localDate, Vakit.ISHAA, array[5]);
                x++;
            } catch (Exception ignore) {
            }
        }

    }


    return x > 25;
}
 
Example 16
Source File: MoroccoTimes.java    From prayer-times-android with Apache License 2.0 4 votes vote down vote up
protected boolean sync() throws ExecutionException, InterruptedException {
    LocalDate ldate = LocalDate.now();
    int rY = ldate.getYear();
    int Y = rY;
    int m = ldate.getMonthOfYear();
    int x = 0;

    for (int M = m; (M <= (m + 1)) && (rY == Y); M++) {
        if (M == 13) {
            M = 1;
            Y++;
        }
        String result = Ion.with(App.get())
                .load("http://www.habous.gov.ma/prieres/defaultmois.php?ville=" + getId() + "&mois=" + M)
                .userAgent(App.getUserAgent())
                .setTimeout(3000)
                .asString()
                .get();
        String temp = result.substring(result.indexOf("colspan=\"4\" class=\"cournt\""));
        temp = temp.substring(temp.indexOf(">") + 1);
        temp = temp.substring(0, temp.indexOf("<")).replace(" ", "");
        int month = Integer.parseInt(temp.substring(0, temp.indexOf("/")));
        int year = Integer.parseInt(temp.substring(temp.indexOf("/") + 1));
        result = result.substring(result.indexOf("<td>") + 4);
        result = result.replace(" ", "").replace("\t", "").replace("\n", "").replace("\r", "");
        String[] zeiten = result.split("<td>");
        for (int i = 0; i < zeiten.length; i++) {
            int day = Integer.parseInt(extract(zeiten[i]));
            String imsak = extract(zeiten[++i]);
            String gunes = extract(zeiten[++i]);
            String ogle = extract(zeiten[++i]);
            String ikindi = extract(zeiten[++i]);
            String aksam = extract(zeiten[++i]);
            String yatsi = extract(zeiten[++i]);

            LocalDate localDate = new LocalDate(year, month, day);
            setTime(localDate, Vakit.FAJR, imsak);
            setTime(localDate, Vakit.SUN, gunes);
            setTime(localDate, Vakit.DHUHR, ogle);
            setTime(localDate, Vakit.ASR, ikindi);
            setTime(localDate, Vakit.MAGHRIB, aksam);
            setTime(localDate, Vakit.ISHAA, yatsi);
            x++;
        }


    }


    return x > 25;
}
 
Example 17
Source File: IGMGTimes.java    From prayer-times-android with Apache License 2.0 4 votes vote down vote up
protected boolean sync() throws ExecutionException, InterruptedException {
    String path = getId().replace("nix", "-1");
    String[] a = path.split("_");
    int id = Integer.parseInt(a[0]);
    if (id <= 0 && a.length > 1)
        id = Integer.parseInt(a[1]);

    LocalDate ldate = LocalDate.now();
    int rY = ldate.getYear();
    int Y = rY;
    int m = ldate.getMonthOfYear();

    int i = 0;
    for (int M = m; (M <= (m + 2)) && (rY == Y); M++) {
        if (M == 13) {
            M = 1;
            Y++;
        }
        String result = Ion.with(App.get())
                .load("POST", "https://www.igmg.org/wp-content/themes/igmg/include/gebetskalender_ajax_api.php")
                .userAgent(App.getUserAgent())
                .setTimeout(3000)
                .setBodyParameter("show_ajax_variable", "" + id)
                .setBodyParameter("show_month", "" + (M - 1))
                .asString()
                .get();

        result = result.substring(result.indexOf("<div class='zeiten'>") + 20);
        String[] zeiten = result.split("</div><div class='zeiten'>");
        for (String zeit : zeiten) {
            if (zeit.contains("turkish")) {
                continue;
            }
            String tarih = extractLine(zeit.substring(zeit.indexOf("tarih")));
            String imsak = extractLine(zeit.substring(zeit.indexOf("imsak")));
            String gunes = extractLine(zeit.substring(zeit.indexOf("gunes")));
            String ogle = extractLine(zeit.substring(zeit.indexOf("ogle")));
            String ikindi = extractLine(zeit.substring(zeit.indexOf("ikindi")));
            String aksam = extractLine(zeit.substring(zeit.indexOf("aksam")));
            String yatsi = extractLine(zeit.substring(zeit.indexOf("yatsi")));

            int _d = Integer.parseInt(tarih.substring(0, 2));
            int _m = Integer.parseInt(tarih.substring(3, 5));
            int _y = Integer.parseInt(tarih.substring(6, 10));
            try {
                LocalDate localDate = new LocalDate(_y, _m, _d);
                setTime(localDate, Vakit.FAJR, imsak);
                setTime(localDate, Vakit.SUN, gunes);
                setTime(localDate, Vakit.DHUHR, ogle);
                setTime(localDate, Vakit.ASR, ikindi);
                setTime(localDate, Vakit.MAGHRIB, aksam);
                setTime(localDate, Vakit.ISHAA, yatsi);
                i++;
            } catch (IllegalFieldValueException ignore) {
            }
        }


    }


    return i > 25;
}
 
Example 18
Source File: PeriodUtil.java    From estatio with Apache License 2.0 4 votes vote down vote up
private static boolean matchesStartCalendarYear(final LocalDate date){
    return date.getDayOfMonth() == 1 && date.getMonthOfYear() == 1 ? true : false;
}
 
Example 19
Source File: PaymentLineExportV1.java    From estatio with Apache License 2.0 4 votes vote down vote up
private int toYearPeriod(final LocalDate date) {
    return date.getYear()*100+ date.getMonthOfYear();
}
 
Example 20
Source File: CalendarUtil.java    From NCalendar with Apache License 2.0 2 votes vote down vote up
/**
 * 第一个是不是第二个的上一个月,只在此处有效
 *
 * @param date1
 * @param date2
 * @return
 */
public static boolean isLastMonth(LocalDate date1, LocalDate date2) {
    LocalDate date = date2.plusMonths(-1);
    return date1.getMonthOfYear() == date.getMonthOfYear();
}