Search in sources :

Example 96 with GregorianCalendar

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;
}
Also used : Calendar(java.util.Calendar) GregorianCalendar(java.util.GregorianCalendar) GregorianCalendar(java.util.GregorianCalendar) Date(java.util.Date)

Example 97 with GregorianCalendar

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());
}
Also used : Calendar(java.util.Calendar) GregorianCalendar(java.util.GregorianCalendar) GregorianCalendar(java.util.GregorianCalendar) Date(java.sql.Date)

Example 98 with GregorianCalendar

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());
}
Also used : Calendar(java.util.Calendar) GregorianCalendar(java.util.GregorianCalendar) GregorianCalendar(java.util.GregorianCalendar) Date(java.sql.Date)

Example 99 with GregorianCalendar

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());
}
Also used : GregorianCalendar(java.util.GregorianCalendar) Calendar(java.util.Calendar) GregorianCalendar(java.util.GregorianCalendar)

Example 100 with GregorianCalendar

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);
}
Also used : GregorianCalendar(java.util.GregorianCalendar) Calendar(java.util.Calendar) GregorianCalendar(java.util.GregorianCalendar) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date)

Aggregations

GregorianCalendar (java.util.GregorianCalendar)1212 Calendar (java.util.Calendar)574 Date (java.util.Date)358 Test (org.junit.Test)233 SimpleDateFormat (java.text.SimpleDateFormat)100 Timestamp (java.sql.Timestamp)54 ScheduleExpression (javax.ejb.ScheduleExpression)51 ArrayList (java.util.ArrayList)47 EJBCronTrigger (org.apache.openejb.core.timer.EJBCronTrigger)42 HashMap (java.util.HashMap)41 ParseException (java.text.ParseException)38 TimeZone (java.util.TimeZone)38 SimpleTimeZone (java.util.SimpleTimeZone)35 BigDecimal (java.math.BigDecimal)32 Date (java.sql.Date)30 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)21 DateFormat (java.text.DateFormat)18 SQLException (java.sql.SQLException)17 Map (java.util.Map)16 Meeting (net.johnpwood.android.standuptimer.model.Meeting)16