Here you can find the source of getQuarterStart(Date date)
public static Date getQuarterStart(Date date)
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { public static Date getQuarterStart(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date);//from w ww . ja va 2s .co m int month = cal.get(Calendar.MONTH); switch (month) { case 0: case 1: case 2: cal.set(Calendar.MONTH, Calendar.JANUARY); break; case 3: case 4: case 5: cal.set(Calendar.MONTH, Calendar.APRIL); break; case 6: case 7: case 8: cal.set(Calendar.MONTH, Calendar.JULY); break; case 9: case 10: case 11: cal.set(Calendar.MONTH, Calendar.OCTOBER); break; default: break; } cal.set(Calendar.DAY_OF_MONTH, 1); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); return cal.getTime(); } }