Here you can find the source of endOfTheMonth(java.util.Date date, Locale locale)
public static java.util.Date endOfTheMonth(java.util.Date date, Locale locale)
//package com.java2s; /*// w ww .j a va2 s . c om * DateTimeUtils.java * * Copyright (c) 1998 - 2006 BusinessTechnology, Ltd. * All rights reserved * * This program is the proprietary and confidential information * of BusinessTechnology, Ltd. and may be used and disclosed only * as authorized in a license agreement authorizing and * controlling such use and disclosure * * Millennium Business Suite Anywhere System. * */ import java.util.Calendar; import java.util.Locale; public class Main { public static java.util.Date endOfTheMonth(java.util.Date date, Locale locale) { Calendar calendar = Calendar.getInstance(locale); calendar.setTime(date); calendar.set(Calendar.DATE, calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); calendar.set(Calendar.HOUR_OF_DAY, 23); calendar.set(Calendar.MINUTE, 59); calendar.set(Calendar.SECOND, 59); return calendar.getTime(); } }