Here you can find the source of getStartDateOfCurrentSemester()
private static Date getStartDateOfCurrentSemester()
//package com.java2s; //License from project: Open Source License import java.util.Date; import java.util.Calendar; public class Main { private static Date getStartDateOfCurrentSemester() { Calendar cal = Calendar.getInstance(); int month = cal.get(Calendar.MONTH); int year = cal.get(Calendar.YEAR); if (month >= 9 && month <= 2) { // Oct 01 00:00:00 CEST year cal.set(year, Calendar.OCTOBER, 1, 0, 0, 0); return cal.getTime(); } else {/* w w w .j ava 2 s . c o m*/ // Apr 01 00:00:00 CEST year cal.set(year, Calendar.APRIL, 1, 0, 0, 0); return cal.getTime(); } } }