package org.jfree.date;
import java.util.Calendar;
import java.util.Date;
/**
* Some useful date methods.
*
* @author David Gilbert.
*/
public class DateUtilities {
/**
* Private constructor to prevent object creation.
*/
private DateUtilities() {
}
/** A working calendar. */
private static final Calendar CALENDAR = Calendar.getInstance();
/**
* Creates a date.
*
* @param yyyy the year.
* @param month the month (1 - 12).
* @param day the day.
*
* @return a date.
*/
public static synchronized Date createDate(final int yyyy, final int month, final int day) {
CALENDAR.clear();
CALENDAR.set(yyyy, month - 1, day);
return CALENDAR.getTime();
}
/**
* Creates a date.
*
* @param yyyy the year.
* @param month the month (1 - 12).
* @param day the day.
* @param hour the hour.
* @param min the minute.
*
* @return a date.
*/
public static synchronized Date createDate(final int yyyy, final int month, final int day, final int hour, final int min) {
CALENDAR.clear();
CALENDAR.set(yyyy, month - 1, day, hour, min);
return CALENDAR.getTime();
}
}