Code example for GregorianCalendar

Methods: add, getTime

    // Method to modify calendar 
    private String modCal(int month, int year) {
        // Getting the current date so all tests start from the same area 
        GregorianCalendar cal = new GregorianCalendar(YEAR_TO_USE, MONTH_TO_USE, DAY_TO_USE);
        // Formatting the calendar in the format that we expect 
        SimpleDateFormat dtFormat = new SimpleDateFormat(MONTH_YEAR_FORMAT);
        // Modifying calendar by either positive or negative months/years 
        cal.add(Calendar.MONTH, month);
        cal.add(Calendar.YEAR, year);
        return dtFormat.format(cal.getTime());
    private String homeEndButtonHelper(String initDate, Keys buttonToPress)
        // Getting the input box, making sure it is clear, and sending in the the starting date 
        WebElement element = findDomElement(By.cssSelector(DATE_INPUT_BOX_SEL));