Java Day End getEndDateOfCurrentSemester()

Here you can find the source of getEndDateOfCurrentSemester()

Description

get End Date Of Current Semester

License

Open Source License

Declaration

private static Date getEndDateOfCurrentSemester() 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Date;
import java.util.Calendar;

public class Main {
    private static Date getEndDateOfCurrentSemester() {
        Calendar cal = Calendar.getInstance();
        int month = cal.get(Calendar.MONTH);
        int year = cal.get(Calendar.YEAR);
        if (month >= 9 && month <= 2) {
            // one second before Apr 01 00:00:00 CEST year
            cal.set(year, Calendar.APRIL, 1, 0, 0, 0);
            cal.add(Calendar.SECOND, -1);
            return cal.getTime();
        } else {//ww  w.j  av  a  2s. co  m
            // one second before Oct 01 00:00:00 CEST year
            cal.set(year, Calendar.OCTOBER, 1, 0, 0, 0);
            cal.add(Calendar.SECOND, -1);
            return cal.getTime();
        }
    }
}

Related

  1. getEndDate(int useMonth)
  2. getEndDate(String date)
  3. getEndDateByDate(Date date)
  4. getEndDateByYears(Date date, int years)
  5. getEndDateForYear()
  6. getEndDateOfMonth(Date given)
  7. getEndMonth(Date sessionEnd, int year, int excessDays)
  8. getEndOfDay(Date d)
  9. getEndOfDay(Date date)