use of com.ibm.icu.util.Calendar in project ofbiz-framework by apache.
the class UtilDateTime method getWeekEnd.
public static Timestamp getWeekEnd(Timestamp stamp, TimeZone timeZone, Locale locale) {
Timestamp weekStart = getWeekStart(stamp, timeZone, locale);
Calendar tempCal = toCalendar(weekStart, timeZone, locale);
tempCal.add(Calendar.DAY_OF_MONTH, 6);
return getDayEnd(new Timestamp(tempCal.getTimeInMillis()), timeZone, locale);
}
use of com.ibm.icu.util.Calendar in project ofbiz-framework by apache.
the class UtilDateTime method getYearEnd.
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);
}
use of com.ibm.icu.util.Calendar in project ofbiz-framework by apache.
the class UtilDateTime method getDayStart.
public static Timestamp getDayStart(Timestamp stamp, int daysLater, TimeZone timeZone, Locale locale) {
Calendar tempCal = toCalendar(stamp, timeZone, locale);
tempCal.set(tempCal.get(Calendar.YEAR), tempCal.get(Calendar.MONTH), tempCal.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
tempCal.add(Calendar.DAY_OF_MONTH, daysLater);
Timestamp retStamp = new Timestamp(tempCal.getTimeInMillis());
retStamp.setNanos(0);
return retStamp;
}
use of com.ibm.icu.util.Calendar in project ofbiz-framework by apache.
the class UtilDateTime method adjustTimestamp.
/**
* Perform date/time arithmetic on a Timestamp. This is the only accurate way to
* perform date/time arithmetic across locales and time zones.
*
* @param stamp date/time to perform arithmetic on
* @param adjType the adjustment type to perform. Use one of the java.util.Calendar fields.
* @param adjQuantity the adjustment quantity.
* @param timeZone
* @param locale
* @return adjusted Timestamp
* @see java.util.Calendar
*/
public static Timestamp adjustTimestamp(Timestamp stamp, int adjType, int adjQuantity, TimeZone timeZone, Locale locale) {
Calendar tempCal = toCalendar(stamp, timeZone, locale);
tempCal.add(adjType, adjQuantity);
return new Timestamp(tempCal.getTimeInMillis());
}
use of com.ibm.icu.util.Calendar in project ofbiz-framework by apache.
the class UtilDateTime method adjustTimestamp.
public static Timestamp adjustTimestamp(Timestamp stamp, Integer adjType, Integer adjQuantity) {
Calendar tempCal = toCalendar(stamp);
tempCal.add(adjType, adjQuantity);
return new Timestamp(tempCal.getTimeInMillis());
}
Aggregations