Example usage for org.jfree.chart.date SerialDate lastDayOfMonth

List of usage examples for org.jfree.chart.date SerialDate lastDayOfMonth

Introduction

In this page you can find the example usage for org.jfree.chart.date SerialDate lastDayOfMonth.

Prototype

public static int lastDayOfMonth(final int month, final int yyyy) 

Source Link

Document

Returns the number of the last day of the month, taking into account leap years.

Usage

From source file:org.jfree.data.time.Quarter.java

/**
 * Returns the last millisecond of the Quarter, evaluated using the
 * supplied calendar (which determines the time zone).
 *
 * @param calendar  the calendar (<code>null</code> not permitted).
 *
 * @return The last millisecond of the Quarter.
 *
 * @throws NullPointerException if {@code calendar} is {@code null}.
 *//* w ww  .  j a  v  a  2s  .  c  o  m*/
@Override
public long getLastMillisecond(Calendar calendar) {
    int month = Quarter.LAST_MONTH_IN_QUARTER[this.quarter];
    int eom = SerialDate.lastDayOfMonth(month, this.year);
    calendar.set(this.year, month - 1, eom, 23, 59, 59);
    calendar.set(Calendar.MILLISECOND, 999);
    return calendar.getTimeInMillis();
}

From source file:org.jfree.data.time.Month.java

/**
 * Returns the last millisecond of the month, evaluated using the supplied
 * calendar (which determines the time zone).
 *
 * @param calendar  the calendar (<code>null</code> not permitted).
 *
 * @return The last millisecond of the month.
 *
 * @throws NullPointerException if {@code calendar} is {@code null}.
 *///from w w  w  .  j a v a 2s .c  o m
@Override
public long getLastMillisecond(Calendar calendar) {
    int eom = SerialDate.lastDayOfMonth(this.month, this.year);
    calendar.set(this.year, this.month - 1, eom, 23, 59, 59);
    calendar.set(Calendar.MILLISECOND, 999);
    return calendar.getTimeInMillis();
}