Author: adrianc
Date: Mon Dec 31 13:02:41 2007
New Revision: 607776
URL:
http://svn.apache.org/viewvc?rev=607776&view=revLog:
New methods for UtilDateTime - get period end Timestamps. The new methods are needed for the forthcoming <set-calendar> simple method operation.
Modified:
ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilDateTime.java
Modified: ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilDateTime.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilDateTime.java?rev=607776&r1=607775&r2=607776&view=diff==============================================================================
--- ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilDateTime.java (original)
+++ ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilDateTime.java Mon Dec 31 13:02:41 2007
@@ -27,7 +27,6 @@
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
-import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
@@ -864,6 +863,12 @@
return retStamp;
}
+ public static Timestamp getMonthEnd(Timestamp stamp, TimeZone timeZone, Locale locale) {
+ Calendar tempCal = toCalendar(stamp, timeZone, locale);
+ tempCal.set(tempCal.get(Calendar.YEAR), tempCal.get(Calendar.MONTH), tempCal.getActualMaximum(Calendar.DAY_OF_MONTH), 0, 0, 0);
+ return getDayEnd(new Timestamp(tempCal.getTimeInMillis()), timeZone, locale);
+ }
+
public static Timestamp getYearStart(Timestamp stamp, TimeZone timeZone, Locale locale) {
return getYearStart(stamp, 0, 0, 0, timeZone, locale);
}
@@ -890,6 +895,12 @@
Timestamp retStamp = new Timestamp(tempCal.getTimeInMillis());
retStamp.setNanos(0);
return retStamp;
+ }
+
+ public static Timestamp getYearEnd(Timestamp stamp, TimeZone timeZone, Locale locale) {
+ Calendar tempCal = toCalendar(stamp, timeZone, locale);
+ tempCal.set(tempCal.get(Calendar.YEAR), tempCal.getActualMaximum(Calendar.MONTH) + 1, 0, 0, 0, 0);
+ return getMonthEnd(new Timestamp(tempCal.getTimeInMillis()), timeZone, locale);
}
public static int weekNumber(Timestamp stamp, TimeZone timeZone, Locale locale) {