Here you can find the source of isFirstOfMonth(long date)
public static boolean isFirstOfMonth(long date)
//package com.java2s; /*//www . j av a 2s. c om * $Id: DateUtils.java,v 1.1 2004/08/12 00:24:33 dmouse Exp $ * * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ import java.util.*; public class Main { private static Calendar CALENDAR = Calendar.getInstance(); public static boolean isFirstOfMonth(long date) { boolean ret = false; Calendar calendar = CALENDAR; synchronized (calendar) { calendar.setTimeInMillis(date); int currentMonth = calendar.get(Calendar.MONTH); // Check yesterday calendar.add(Calendar.DATE, -1); int yesterdayMonth = calendar.get(Calendar.MONTH); ret = (currentMonth != yesterdayMonth); } return ret; } }