Java Day End endOfTheMonth(java.util.Date date, Locale locale)

Here you can find the source of endOfTheMonth(java.util.Date date, Locale locale)

Description

end Of The Month

License

Open Source License

Declaration

public static java.util.Date endOfTheMonth(java.util.Date date, Locale locale) 

Method Source Code


//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();
    }
}

Related

  1. endOfDay(Date value)
  2. endOfDay(final Date date)
  3. endOfDay(final Date date)
  4. endOfDayDate(Date date)
  5. endOfDayInMillis(long date)
  6. endOfYear(Date referenceDate, TimeZone timeZone)
  7. fillBetweenDays(Date from, Date to)
  8. getAgeInDays(Date startDate, Date endDate)
  9. getApartDate(Date startDate, Date endDate)