Here you can find the source of getQuarterNum(Date dt)
public static int getQuarterNum(Date dt)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main { public static int getQuarterNum(Date dt) { if (dt == null) return 0; GregorianCalendar gc = new GregorianCalendar(); gc.setTime(dt);/*from w w w . jav a 2 s. c o m*/ int thisMonth = gc.get(Calendar.MONTH); return thisMonth / 4 + 1; } }