Mercurial > dive4elements > framework
view artifacts-common/src/main/java/de/intevation/artifacts/common/utils/DateUtils.java @ 435:e39e23320a23
Fixed small problem with extractiong zip files.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Sat, 06 Oct 2012 14:20:40 +0200 |
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); } }