Example usage for org.jfree.data.time Month Month

List of usage examples for org.jfree.data.time Month Month

Introduction

In this page you can find the example usage for org.jfree.data.time Month Month.

Prototype

public Month(Date time, TimeZone zone, Locale locale) 

Source Link

Document

Creates a new Month instance, based on the specified time, zone and locale.

Usage

From source file:org.jfree.data.time.junit.MonthTest.java

/**
 * In GMT, the end of Feb 2000 is java.util.Date(951,868,799,999L).  Use
 * this to check the Month constructor./*w  w w .j  a  va  2s . c  o m*/
 */
public void testDateConstructor1() {

    TimeZone zone = TimeZone.getTimeZone("GMT");
    Calendar c = new GregorianCalendar(zone);
    Locale locale = Locale.UK;
    Month m1 = new Month(new Date(951868799999L), zone, locale);
    Month m2 = new Month(new Date(951868800000L), zone, locale);

    assertEquals(MonthConstants.FEBRUARY, m1.getMonth());
    assertEquals(951868799999L, m1.getLastMillisecond(c));

    assertEquals(MonthConstants.MARCH, m2.getMonth());
    assertEquals(951868800000L, m2.getFirstMillisecond(c));

}

From source file:org.jfree.data.time.junit.MonthTest.java

/**
 * In Auckland, the end of Feb 2000 is java.util.Date(951,821,999,999L).
 * Use this to check the Month constructor.
 *//*from w  w w. ja  va  2  s  .  c o  m*/
public void testDateConstructor2() {

    TimeZone zone = TimeZone.getTimeZone("Pacific/Auckland");
    Calendar c = new GregorianCalendar(zone);
    Month m1 = new Month(new Date(951821999999L), zone, Locale.UK);
    Month m2 = new Month(new Date(951822000000L), zone, Locale.UK);

    assertEquals(MonthConstants.FEBRUARY, m1.getMonth());
    assertEquals(951821999999L, m1.getLastMillisecond(c));

    assertEquals(MonthConstants.MARCH, m2.getMonth());
    assertEquals(951822000000L, m2.getFirstMillisecond(c));

}