use of java.util.GregorianCalendar in project head by mifos.
the class CalendarTest method createPreviousDate.
private Date createPreviousDate(int numberOfDays) {
Calendar calendar = new GregorianCalendar();
calendar.setTime(new Date());
calendar.add(Calendar.DATE, -numberOfDays);
Date pastDate = DateUtils.getDateWithoutTimeStamp(calendar.getTime());
return pastDate;
}
use of java.util.GregorianCalendar in project head by mifos.
the class SavingsOfferingBOIntegrationTest method reduceCurrentDate.
private java.sql.Date reduceCurrentDate(final int noOfDays) {
Calendar currentDateCalendar = new GregorianCalendar();
int year = currentDateCalendar.get(Calendar.YEAR);
int month = currentDateCalendar.get(Calendar.MONTH);
int day = currentDateCalendar.get(Calendar.DAY_OF_MONTH);
currentDateCalendar = new GregorianCalendar(year, month, day - noOfDays);
return new java.sql.Date(currentDateCalendar.getTimeInMillis());
}
use of java.util.GregorianCalendar in project head by mifos.
the class SavingsOfferingBOIntegrationTest method offSetCurrentDate.
private java.sql.Date offSetCurrentDate(final int noOfDays) {
Calendar currentDateCalendar = new GregorianCalendar();
int year = currentDateCalendar.get(Calendar.YEAR);
int month = currentDateCalendar.get(Calendar.MONTH);
int day = currentDateCalendar.get(Calendar.DAY_OF_MONTH);
currentDateCalendar = new GregorianCalendar(year, month, day + noOfDays);
return new java.sql.Date(currentDateCalendar.getTimeInMillis());
}
use of java.util.GregorianCalendar in project head by mifos.
the class AccountBO method changeFirstInstallmentDateBy.
public void changeFirstInstallmentDateBy(final int numberOfDays) {
Calendar currentDateCalendar = new GregorianCalendar();
int year = currentDateCalendar.get(Calendar.YEAR);
int month = currentDateCalendar.get(Calendar.MONTH);
int day = currentDateCalendar.get(Calendar.DAY_OF_MONTH);
currentDateCalendar = new GregorianCalendar(year, month, day + numberOfDays);
changeActionDateOfFirstInstallment(currentDateCalendar, getAccountActionDates());
}
use of java.util.GregorianCalendar in project head by mifos.
the class LoanAccountActionStrutsTest method offSetCurrentDate.
private String offSetCurrentDate(int noOfDays, Locale locale) throws InvalidDateException {
Calendar currentDateCalendar = new GregorianCalendar();
int year = currentDateCalendar.get(Calendar.YEAR);
int month = currentDateCalendar.get(Calendar.MONTH);
int day = currentDateCalendar.get(Calendar.DAY_OF_MONTH);
currentDateCalendar = new GregorianCalendar(year, month, day + noOfDays);
java.sql.Date currentDate = new java.sql.Date(currentDateCalendar.getTimeInMillis());
SimpleDateFormat format = (SimpleDateFormat) DateFormat.getDateInstance(DateFormat.SHORT, locale);
String userfmt = DateUtils.convertToCurrentDateFormat(format.toPattern());
return DateUtils.convertDbToUserFmt(currentDate.toString(), userfmt);
}
Aggregations