I want define some constants, specifically a Date and Calendar that are before my domain can exist. I've got some code that works but its ugly. I am looking for improvement suggestions.
static Calendar working;
static {
working = GregorianCalendar.getInstance();
working.set(1776, 6, 4, 0, 0, 1);
}
public static final Calendar beforeFirstCalendar = working;
public static final Date beforeFirstDate = working.getTime();
I'm setting them to July 4th, 1776. I'd rather not have the "working" variable at all.
Thanks
I'm not sure I understand....but doesn't this work?
public static final Calendar beforeFirstCalendar;
static {
beforeFirstCalendar = GregorianCalendar.getInstance();
beforeFirstCalendar.set(1776, 6, 4, 0, 0, 1);
}
public static final Date beforeFirstDate = beforeFirstCalendar.getTime();