Java tutorial
//package com.java2s; import java.util.Calendar; public class Main { public static void setToFirstDay(Calendar calendar) { int year = getYear(calendar); int month = getMonth(calendar); calendar.clear(); calendar.set(year, month, 1); } public static int getYear(Calendar c) { return c.get(Calendar.YEAR); } public static int getMonth(Calendar c) { return c.get(Calendar.MONTH); } }