Mercurial > dive4elements > river
view backend/src/main/java/org/dive4elements/river/backend/utils/DateUtil.java @ 9726:0a5239a1e46e 3.2.x
Upgrade to Log4j 2
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Wed, 02 Mar 2022 10:26:50 +0100 |
parents | 3bb1c62ad732 |
children |
line wrap: on
line source
/* Copyright (C) 2014 by Bundesanstalt für Gewässerkunde * Software engineering by Intevation GmbH * * This file is Free Software under the GNU AGPL (>=v3) * and comes with ABSOLUTELY NO WARRANTY! Check out the * documentation coming with Dive4Elements River for details. */ package org.dive4elements.river.backend.utils; import java.util.Date; import java.util.Calendar; public final class DateUtil { private DateUtil() { } /** Create Date on first moment (1st jan) of given year. */ public static Date getStartDateFromYear(int year) { Calendar cal = Calendar.getInstance(); cal.clear(); cal.set(year, 0, 1, 0, 0, 0); return cal.getTime(); } /** Create Date on last moment (31st dec) of given year. */ public static Date getEndDateFromYear(int year) { Calendar cal = Calendar.getInstance(); cal.clear(); cal.set(year, 11, 31, 23, 59, 59); return cal.getTime(); } }