tom@7927: /* Copyright (C) 2014 by Bundesanstalt für Gewässerkunde tom@7927: * Software engineering by Intevation GmbH tom@7927: * tom@7927: * This file is Free Software under the GNU AGPL (>=v3) tom@7927: * and comes with ABSOLUTELY NO WARRANTY! Check out the tom@7927: * documentation coming with Dive4Elements River for details. tom@7927: */ tom@7927: tom@7927: package org.dive4elements.river.utils; tom@7927: tom@7927: import java.util.Date; tom@7927: import java.util.Calendar; tom@7927: tom@7927: public final class DateUtil { tom@7927: tom@7927: private DateUtil() { tom@7927: } tom@7927: tom@7927: /** Create Date on first moment (1st jan) of given year. */ tom@7927: public static Date getStartDateFromYear(int year) { tom@7927: Calendar cal = Calendar.getInstance(); tom@7927: cal.clear(); tom@7927: cal.set(year, 0, 1, 0, 0, 0); tom@7927: tom@7927: return cal.getTime(); tom@7927: } tom@7927: tom@7927: tom@7927: /** Create Date on last moment (31st dec) of given year. */ tom@7927: public static Date getEndDateFromYear(int year) { tom@7927: Calendar cal = Calendar.getInstance(); tom@7927: cal.clear(); tom@7927: cal.set(year, 11, 31, 23, 59, 59); tom@7927: tom@7927: return cal.getTime(); tom@7927: } tom@7927: }