Here you can find the source of getQuarterYear(Date dateParam)
public static int getQuarterYear(Date dateParam)
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { public static int getQuarterYear(Date dateParam) { if (dateParam == null) { throw new IllegalArgumentException("The dateParam must not be null"); }//from ww w . j a v a 2s . co m Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(dateParam.getTime()); return cal.get(Calendar.MONTH) / 3 + 1; } public static long getTime(Date dateParam) { if (dateParam == null) { throw new IllegalArgumentException("The dateParam must not be null"); } Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(dateParam.getTime()); int hour = cal.get(Calendar.HOUR); int minute = cal.get(Calendar.MINUTE); int second = cal.get(Calendar.SECOND); long result = hour * 3600 * 1000 + minute * 60 * 1000 + second * 1000; return result; } }