Mercurial > dive4elements > framework
view artifacts-common/src/main/java/de/intevation/artifacts/common/utils/DateUtils.java @ 456:afbe26bb9895
Do not try to look for . and .. while fixing paths
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Fri, 01 Mar 2013 12:02:25 +0100 |
parents | ea263ee87563 |
children |
line wrap: on
line source
package de.intevation.artifacts.common.utils; import java.util.Calendar; import java.util.Date; public class DateUtils { private DateUtils() { } /** * This function extracts the year as int value from <i>date</i>. * * @param date The source date. * * @return the year as integer or -1 if date is empty. */ public static int getYearFromDate(Date date) { if (date == null) { return -1; } Calendar cal = Calendar.getInstance(); cal.setTime(date); return cal.get(Calendar.YEAR); } }