Example usage for java.util Calendar APRIL

List of usage examples for java.util Calendar APRIL

Introduction

In this page you can find the example usage for java.util Calendar APRIL.

Prototype

int APRIL

To view the source code for java.util Calendar APRIL.

Click Source Link

Document

Value of the #MONTH field indicating the fourth month of the year in the Gregorian and Julian calendars.

Usage

From source file:Main.java

public static String getDateString() {
    String stringDate = "";
    Calendar calendar = Calendar.getInstance();
    int day = calendar.get(Calendar.DAY_OF_WEEK);
    int month = calendar.get(Calendar.MONTH);
    int dayInt = calendar.get(Calendar.DAY_OF_MONTH);
    switch (day) {
    case Calendar.SUNDAY:
        stringDate += "Sunday";
        break;//from   www .j a  v a2s.  c om

    case Calendar.MONDAY:
        stringDate += "Monday";
        break;

    case Calendar.TUESDAY:
        stringDate += "Tuesday";
        break;

    case Calendar.WEDNESDAY:
        stringDate += "Wednesday";
        break;

    case Calendar.THURSDAY:
        stringDate += "Thursday";
        break;

    case Calendar.FRIDAY:
        stringDate += "Friday";
        break;

    case Calendar.SATURDAY:
        stringDate += "Saturday";
        break;

    }
    switch (month) {
    case Calendar.JANUARY:
        stringDate += ", January";
        break;

    case Calendar.FEBRUARY:
        stringDate += ", February";
        break;

    case Calendar.MARCH:
        stringDate += ", March";
        break;

    case Calendar.APRIL:
        stringDate += ", April";
        break;

    case Calendar.MAY:
        stringDate += ", May";
        break;

    case Calendar.JUNE:
        stringDate += ", June";
        break;

    case Calendar.JULY:
        stringDate += ", July";
        break;

    case Calendar.AUGUST:
        stringDate += ", August";
        break;

    case Calendar.SEPTEMBER:
        stringDate += ", September";
        break;

    case Calendar.OCTOBER:
        stringDate += ", October";
        break;

    case Calendar.NOVEMBER:
        stringDate += ", November";
        break;

    case Calendar.DECEMBER:
        stringDate += ", December";
        break;

    }

    stringDate += (" " + dayInt);

    return stringDate;
}

From source file:Main.java

public static int getDaysInMonth(int month, int year) {
    switch (month) {
    case Calendar.JANUARY:
    case Calendar.MARCH:
    case Calendar.MAY:
    case Calendar.JULY:
    case Calendar.AUGUST:
    case Calendar.OCTOBER:
    case Calendar.DECEMBER:
        return 31;
    case Calendar.APRIL:
    case Calendar.JUNE:
    case Calendar.SEPTEMBER:
    case Calendar.NOVEMBER:
        return 30;
    case Calendar.FEBRUARY:
        return ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) ? 29 : 28;
    default:/* w w  w .  j a  v a 2s  .  c  o m*/
        throw new IllegalArgumentException("Invalid Month");
    }
}

From source file:Main.java

public static int getDaysInMonth(int month, int year) {
    switch (month) {
    case Calendar.JANUARY:
    case Calendar.MARCH:
    case Calendar.MAY:
    case Calendar.JULY:
    case Calendar.AUGUST:
    case Calendar.OCTOBER:
    case Calendar.DECEMBER:
        return 31;
    case Calendar.APRIL:
    case Calendar.JUNE:
    case Calendar.SEPTEMBER:
    case Calendar.NOVEMBER:
        return 30;
    case Calendar.FEBRUARY:
        return ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) ? 28 : 29;
    default://from   w w  w  . java  2  s.  c o  m
        throw new IllegalArgumentException("Invalid Month");
    }
}

From source file:cz.cvut.kbss.wpa.service.test.PlayerServiceTest.java

@BeforeClass
public static void setUp() {
    b = Calendar.getInstance();//  w  w  w.ja  va2s. c  om
    b.set(Calendar.YEAR, 1986);
    b.set(Calendar.MONTH, Calendar.APRIL);
    b.set(Calendar.DAY_OF_MONTH, 28);
    b.set(Calendar.HOUR, 0);
    b.set(Calendar.MINUTE, 0);
    b.set(Calendar.SECOND, 0);
}

From source file:srvmonitor.thGetAgendas.java

@Override
public void run() {
    /*/*from w  w  w  . java2  s  .  co  m*/
    Recupera Parametros Fecha Actual
    */
    logger.info("Buscando Agendas Activas");

    String[] ids = TimeZone.getAvailableIDs(-4 * 60 * 60 * 1000);
    String clt = ids[0];
    SimpleTimeZone tz = new SimpleTimeZone(-4 * 60 * 60 * 1000, clt);
    tz.setStartRule(Calendar.APRIL, 1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
    tz.setEndRule(Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
    Calendar calendar = new GregorianCalendar(tz);

    int year = calendar.get(Calendar.YEAR);
    int month = calendar.get(Calendar.MONTH); // Jan = 0, dec = 11
    int dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH);
    int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);
    int weekOfYear = calendar.get(Calendar.WEEK_OF_YEAR);
    int weekOfMonth = calendar.get(Calendar.WEEK_OF_MONTH);

    int hour = calendar.get(Calendar.HOUR); // 12 hour clock
    int hourOfDay = calendar.get(Calendar.HOUR_OF_DAY); // 24 hour clock
    int minute = calendar.get(Calendar.MINUTE);
    int second = calendar.get(Calendar.SECOND);
    int millisecond = calendar.get(Calendar.MILLISECOND);

    int findHour = 12;
    int findMinutes = 5;

    /*
    calendar.add(Calendar.HOUR_OF_DAY, -1);
    int hourBefore = calendar.get(Calendar.HOUR_OF_DAY);
            
    calendar.add(Calendar.HOUR_OF_DAY, 2);
    int hourAfter = calendar.get(Calendar.HOUR_OF_DAY);
    */

    String posmonth = String.valueOf(month + 1);
    String posdayOfMonth = String.valueOf(dayOfMonth);
    String posdayOfWeek = String.valueOf(dayOfWeek);
    String posweekOfYear = String.valueOf(weekOfYear);
    String posweekOfMonth = String.valueOf(weekOfMonth);
    String poshourOfDay = String.valueOf(hourOfDay);
    String posminute = String.valueOf(minute);
    String possecond = String.valueOf(second);
    String posmillisecond = String.valueOf(millisecond);

    Calendar iteratorCalendar;
    String vSQL;
    String iteratorHour;
    String iteratorMinute;
    Statement stm;
    JSONObject jData;
    JSONObject jDataMinute;
    JSONArray jArray = new JSONArray();
    JSONArray jArrayMinute = new JSONArray();
    String posIteratorHour;
    String posIteratorMinute;

    /*
    Inicializa Lista de Agendas
    */
    gDatos.getLstShowAgendas().clear();
    gDatos.getLstActiveAgendas().clear();

    for (int i = -findHour; i <= findHour; i++) {
        iteratorCalendar = new GregorianCalendar(tz);
        iteratorCalendar.add(Calendar.HOUR_OF_DAY, i);
        iteratorHour = String.valueOf(iteratorCalendar.get(Calendar.HOUR_OF_DAY));
        posIteratorHour = String.valueOf(Integer.valueOf(iteratorHour) + 1);

        vSQL = "select " + iteratorHour
                + " horaAgenda,ageID, month, dayOfMonth, dayOfWeek, weekOfYear, weekOfMonth, hourOfDay from process.tb_agenda where "
                + "     ageEnable=1 " + "     and substr(month," + posmonth + ",1) = '1'"
                + "     and substr(dayOfMonth," + posdayOfMonth + ",1) = '1'" + "     and substr(dayOfWeek,"
                + posdayOfWeek + ",1) = '1'" + "     and substr(weekOfYear," + posweekOfYear + ",1) = '1'"
                + "     and substr(weekOfMonth," + posweekOfMonth + ",1) = '1'" + "     and substr(hourOfDay,"
                + posIteratorHour + ",1) = '1'";
        logger.debug("i: " + i + " vSQL: " + vSQL);
        try {
            stm = gDatos.getServerStatus().getMetadataConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY,
                    ResultSet.CONCUR_READ_ONLY);
            jData = new JSONObject();

            ResultSet rs = stm.executeQuery(vSQL);
            if (rs != null) {
                while (rs.next()) {
                    jData = new JSONObject();
                    jData.put("horaAgenda", rs.getString("horaAgenda"));
                    jData.put("ageID", rs.getString("ageID"));
                    jData.put("month", rs.getString("month"));
                    jData.put("dayOfMonth", rs.getString("dayOfMonth"));
                    jData.put("weekOfYear", rs.getString("weekOfYear"));
                    jData.put("weekOfMonth", rs.getString("weekOfMonth"));
                    jData.put("hourOfDay", rs.getString("hourOfDay"));
                    jArray.put(jData);
                    gDatos.getLstShowAgendas().add(jData);
                }
            } else {
                jData.put("horaAgenda", iteratorHour);
                jData.put("ageID", "");
                jData.put("month", "");
                jData.put("dayOfMonth", "");
                jData.put("weekOfYear", "");
                jData.put("weekOfMonth", "");
                jData.put("hourOfDay", "");
                jArray.put(jData);
                gDatos.getLstShowAgendas().add(jData);
                System.out.println("No hay registros");
            }
            stm.close();
        } catch (SQLException | JSONException e) {
            logger.error(e.getMessage());
        }
    }

    iteratorCalendar = new GregorianCalendar(tz);
    iteratorHour = String.valueOf(iteratorCalendar.get(Calendar.HOUR_OF_DAY));
    posIteratorHour = String.valueOf(Integer.valueOf(iteratorHour) + 1);

    for (int i = -findMinutes; i <= 0; i++) {
        iteratorCalendar = new GregorianCalendar(tz);
        iteratorCalendar.add(Calendar.MINUTE, i);
        iteratorMinute = String.valueOf(iteratorCalendar.get(Calendar.MINUTE));
        posIteratorMinute = String.valueOf(Integer.valueOf(iteratorMinute) + 1);

        vSQL = "select " + iteratorMinute
                + " horaAgenda,ageID, month, dayOfMonth, dayOfWeek, weekOfYear, weekOfMonth, hourOfDay from process.tb_agenda where "
                + "     ageEnable=1 " + "     and substr(month," + posmonth + ",1) = '1'"
                + "     and substr(dayOfMonth," + posdayOfMonth + ",1) = '1'" + "     and substr(dayOfWeek,"
                + posdayOfWeek + ",1) = '1'" + "     and substr(weekOfYear," + posweekOfYear + ",1) = '1'"
                + "     and substr(weekOfMonth," + posweekOfMonth + ",1) = '1'" + "     and substr(hourOfDay,"
                + posIteratorHour + ",1) = '1'" + "     and substr(minute," + posIteratorMinute + ",1) = '1'";
        logger.debug("i: " + i + " vSQL: " + vSQL);
        try {
            stm = gDatos.getServerStatus().getMetadataConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY,
                    ResultSet.CONCUR_READ_ONLY);

            ResultSet rs = stm.executeQuery(vSQL);
            if (rs != null) {
                while (rs.next()) {
                    jDataMinute = new JSONObject();
                    jDataMinute.put("horaAgenda", rs.getString("horaAgenda"));
                    jDataMinute.put("ageID", rs.getString("ageID"));
                    jDataMinute.put("month", rs.getString("month"));
                    jDataMinute.put("dayOfMonth", rs.getString("dayOfMonth"));
                    jDataMinute.put("weekOfYear", rs.getString("weekOfYear"));
                    jDataMinute.put("weekOfMonth", rs.getString("weekOfMonth"));
                    jDataMinute.put("hourOfDay", rs.getString("hourOfDay"));
                    jArrayMinute.put(jDataMinute);
                    gDatos.getLstActiveAgendas().add(jDataMinute);
                }
            }
            stm.close();
        } catch (SQLException | JSONException e) {
            logger.error(e.getMessage());
        }
    }

    for (int i = 0; i < gDatos.getLstShowAgendas().size(); i++) {
        logger.debug(gDatos.getLstShowAgendas().get(i).toString());
    }

    for (int i = 0; i < gDatos.getLstActiveAgendas().size(); i++) {
        logger.debug(gDatos.getLstActiveAgendas().get(i).toString());
    }

    logger.info("Finaliza busquenda agendas activas...");
}

From source file:ubic.gemma.core.analysis.preprocess.batcheffects.BatchInfoPopulationServiceTest.java

@Test
public void testDatesToBatchA() {
    BatchInfoPopulationHelperServiceImpl ser = new BatchInfoPopulationHelperServiceImpl();

    Calendar cal = Calendar.getInstance();
    cal.set(2004, Calendar.APRIL, 10, 10, 1, 1);
    Date d = cal.getTime();//from   ww  w  . j  a  va  2 s  . c  o m

    Collection<Date> dates = new HashSet<>();

    dates.add(d);
    dates.add(DateUtils.addHours(d, 1)); // first batch
    dates.add(DateUtils.addHours(d, 2)); // first batch
    dates.add(DateUtils.addHours(d, 3)); // first batch
    dates.add(DateUtils.addHours(d, 24)); // second batch
    dates.add(DateUtils.addHours(d, 25));// second batch
    dates.add(DateUtils.addHours(d, 26));// second batch
    dates.add(DateUtils.addHours(d, 27));// second batch

    Map<String, Collection<Date>> actual = ser.convertDatesToBatches(dates);

    /*
     * How many unique values?
     */
    Set<String> s = new HashSet<>(actual.keySet());
    assertEquals(2, s.size());
}

From source file:ch.cyberduck.core.ftp.parser.TrellixFTPEntryParserTest.java

@Test
public void testParse() throws Exception {
    FTPFile parsed;/*w  w  w.ja  va  2 s  .c o  m*/

    //#1213
    parsed = parser.parseFTPEntry("-rw-r--r--  FTP  User       10439 Apr 20 05:29 ASCheckbox_2_0.zip");
    assertNotNull(parsed);
    assertEquals("ASCheckbox_2_0.zip", parsed.getName());
    assertEquals(FTPFile.FILE_TYPE, parsed.getType());
    assertEquals(10439, parsed.getSize());
    assertEquals(Calendar.APRIL, parsed.getTimestamp().get(Calendar.MONTH));
    assertEquals(20, parsed.getTimestamp().get(Calendar.DAY_OF_MONTH));
    assertTrue(parsed.hasPermission(FTPFile.USER_ACCESS, FTPFile.READ_PERMISSION));
    assertTrue(parsed.hasPermission(FTPFile.GROUP_ACCESS, FTPFile.READ_PERMISSION));
    assertTrue(parsed.hasPermission(FTPFile.WORLD_ACCESS, FTPFile.READ_PERMISSION));
    assertTrue(parsed.hasPermission(FTPFile.USER_ACCESS, FTPFile.WRITE_PERMISSION));
    assertFalse(parsed.hasPermission(FTPFile.GROUP_ACCESS, FTPFile.WRITE_PERMISSION));
    assertFalse(parsed.hasPermission(FTPFile.WORLD_ACCESS, FTPFile.WRITE_PERMISSION));
    assertFalse(parsed.hasPermission(FTPFile.USER_ACCESS, FTPFile.EXECUTE_PERMISSION));
    assertFalse(parsed.hasPermission(FTPFile.GROUP_ACCESS, FTPFile.EXECUTE_PERMISSION));
    assertFalse(parsed.hasPermission(FTPFile.WORLD_ACCESS, FTPFile.EXECUTE_PERMISSION));
}

From source file:ch.cyberduck.core.ftp.parser.FreeboxFTPEntryParserTest.java

@Test
public void testParse() {
    FTPFile parsed;//from  w w w .  ja  va 2s.co m

    parsed = parser.parseFTPEntry(
            "-rw-r--r--   1  freebox  freebox 2064965868 Apr 15 21:17 M6 - Capital 15-04-2007 21h37 1h40m.ts");
    assertNotNull(parsed);
    assertEquals(parsed.getName(), "M6 - Capital 15-04-2007 21h37 1h40m.ts");
    assertEquals(FTPFile.FILE_TYPE, parsed.getType());
    assertEquals("freebox", parsed.getUser());
    assertEquals("freebox", parsed.getGroup());
    assertEquals(2064965868, parsed.getSize());
    assertEquals(Calendar.APRIL, parsed.getTimestamp().get(Calendar.MONTH));
    assertEquals(15, parsed.getTimestamp().get(Calendar.DAY_OF_MONTH));

    parsed = parser.parseFTPEntry(
            "-rw-r--r--   1  freebox  freebox 75906880 Sep 08 06:33 Direct 8 - Gym direct - 08-09-2007 08h30 1h08m.ts");
    assertNotNull(parsed);
    assertEquals("Direct 8 - Gym direct - 08-09-2007 08h30 1h08m.ts", parsed.getName());
    assertEquals(FTPFile.FILE_TYPE, parsed.getType());
    assertEquals("freebox", parsed.getUser());
    assertEquals("freebox", parsed.getGroup());
    assertEquals(75906880, parsed.getSize());
    assertEquals(Calendar.SEPTEMBER, parsed.getTimestamp().get(Calendar.MONTH));
    assertEquals(8, parsed.getTimestamp().get(Calendar.DAY_OF_MONTH));
    assertTrue(parsed.hasPermission(FTPFile.USER_ACCESS, FTPFile.READ_PERMISSION));
    assertTrue(parsed.hasPermission(FTPFile.GROUP_ACCESS, FTPFile.READ_PERMISSION));
    assertTrue(parsed.hasPermission(FTPFile.WORLD_ACCESS, FTPFile.READ_PERMISSION));
    assertTrue(parsed.hasPermission(FTPFile.USER_ACCESS, FTPFile.WRITE_PERMISSION));
    assertFalse(parsed.hasPermission(FTPFile.GROUP_ACCESS, FTPFile.WRITE_PERMISSION));
    assertFalse(parsed.hasPermission(FTPFile.WORLD_ACCESS, FTPFile.WRITE_PERMISSION));
    assertFalse(parsed.hasPermission(FTPFile.USER_ACCESS, FTPFile.EXECUTE_PERMISSION));
    assertFalse(parsed.hasPermission(FTPFile.GROUP_ACCESS, FTPFile.EXECUTE_PERMISSION));
    assertFalse(parsed.hasPermission(FTPFile.WORLD_ACCESS, FTPFile.EXECUTE_PERMISSION));

    parsed = parser.parseFTPEntry(
            "-rw-r--r--   1  freebox  freebox 1171138668 May 19 17:20 France 3 national - 19-05-2007 18h15 1h05m.ts");
    assertNotNull(parsed);
    assertEquals("France 3 national - 19-05-2007 18h15 1h05m.ts", parsed.getName());
}

From source file:one.GanttDemo1.java

/**
 * Creates a sample dataset for a Gantt chart.
 *
 * @return The dataset./*  w  ww  .jav a 2  s.co m*/
 */
public static IntervalCategoryDataset createDataset() {

    final TaskSeries s1 = new TaskSeries("Scheduled");
    s1.add(new Task("Write Proposal",
            new SimpleTimePeriod(date(1, Calendar.APRIL, 2001), date(5, Calendar.APRIL, 2001))));
    s1.add(new Task("Obtain Approval",
            new SimpleTimePeriod(date(9, Calendar.APRIL, 2001), date(9, Calendar.APRIL, 2001))));
    s1.add(new Task("Requirements Analysis",
            new SimpleTimePeriod(date(10, Calendar.APRIL, 2001), date(5, Calendar.MAY, 2001))));
    s1.add(new Task("Design Phase",
            new SimpleTimePeriod(date(6, Calendar.MAY, 2001), date(30, Calendar.MAY, 2001))));
    s1.add(new Task("Design Signoff",
            new SimpleTimePeriod(date(2, Calendar.JUNE, 2001), date(2, Calendar.JUNE, 2001))));
    s1.add(new Task("Alpha Implementation",
            new SimpleTimePeriod(date(3, Calendar.JUNE, 2001), date(31, Calendar.JULY, 2001))));
    s1.add(new Task("Design Review",
            new SimpleTimePeriod(date(1, Calendar.AUGUST, 2001), date(8, Calendar.AUGUST, 2001))));
    s1.add(new Task("Revised Design Signoff",
            new SimpleTimePeriod(date(10, Calendar.AUGUST, 2001), date(10, Calendar.AUGUST, 2001))));
    s1.add(new Task("Beta Implementation",
            new SimpleTimePeriod(date(12, Calendar.AUGUST, 2001), date(12, Calendar.SEPTEMBER, 2001))));
    s1.add(new Task("Testing",
            new SimpleTimePeriod(date(13, Calendar.SEPTEMBER, 2001), date(31, Calendar.OCTOBER, 2001))));
    s1.add(new Task("Final Implementation",
            new SimpleTimePeriod(date(1, Calendar.NOVEMBER, 2001), date(15, Calendar.NOVEMBER, 2001))));
    s1.add(new Task("Signoff",
            new SimpleTimePeriod(date(28, Calendar.NOVEMBER, 2001), date(30, Calendar.NOVEMBER, 2001))));
    s1.add(new Task("Database set up",
            new SimpleTimePeriod(date(15, Calendar.OCTOBER, 2001), date(30, Calendar.OCTOBER, 2001))));

    final TaskSeries s2 = new TaskSeries("Actual");
    s2.add(new Task("Write Proposal",
            new SimpleTimePeriod(date(1, Calendar.APRIL, 2001), date(5, Calendar.APRIL, 2001))));
    s2.add(new Task("Obtain Approval",
            new SimpleTimePeriod(date(9, Calendar.APRIL, 2001), date(9, Calendar.APRIL, 2001))));
    s2.add(new Task("Requirements Analysis",
            new SimpleTimePeriod(date(10, Calendar.APRIL, 2001), date(15, Calendar.MAY, 2001))));
    s2.add(new Task("Design Phase",
            new SimpleTimePeriod(date(15, Calendar.MAY, 2001), date(17, Calendar.JUNE, 2001))));
    s2.add(new Task("Design Signoff",
            new SimpleTimePeriod(date(30, Calendar.JUNE, 2001), date(30, Calendar.JUNE, 2001))));
    s2.add(new Task("Alpha Implementation",
            new SimpleTimePeriod(date(1, Calendar.JULY, 2001), date(12, Calendar.SEPTEMBER, 2001))));
    s2.add(new Task("Design Review",
            new SimpleTimePeriod(date(12, Calendar.SEPTEMBER, 2001), date(22, Calendar.SEPTEMBER, 2001))));
    s2.add(new Task("Revised Design Signoff",
            new SimpleTimePeriod(date(25, Calendar.SEPTEMBER, 2001), date(27, Calendar.SEPTEMBER, 2001))));
    s2.add(new Task("Beta Implementation",
            new SimpleTimePeriod(date(27, Calendar.SEPTEMBER, 2001), date(30, Calendar.OCTOBER, 2001))));
    s2.add(new Task("Testing",
            new SimpleTimePeriod(date(31, Calendar.OCTOBER, 2001), date(17, Calendar.NOVEMBER, 2001))));
    s2.add(new Task("Final Implementation",
            new SimpleTimePeriod(date(18, Calendar.NOVEMBER, 2001), date(5, Calendar.DECEMBER, 2001))));
    s2.add(new Task("Signoff",
            new SimpleTimePeriod(date(10, Calendar.DECEMBER, 2001), date(11, Calendar.DECEMBER, 2001))));

    final TaskSeriesCollection collection = new TaskSeriesCollection();
    collection.add(s1);
    collection.add(s2);

    return collection;
}

From source file:com.example.geomesa.authorizations.AuthorizationsTutorial.java

/**
 * Creates a base filter that will return a small subset of our results. This can be tweaked to
 * return different results if desired. Currently it should return 16 results.
 *
 * @return//from ww w  .ja  va2  s  . c o  m
 *
 * @throws CQLException
 * @throws IOException
 */
static Filter createBaseFilter() throws CQLException, IOException {

    // Get a FilterFactory2 to build up our query
    FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();

    // We are going to query for events in Ukraine during the
    // civil unrest.

    // We'll start by looking at a particular day in February of 2014
    Calendar calendar = Calendar.getInstance();
    calendar.clear();
    calendar.set(Calendar.YEAR, 2013);
    calendar.set(Calendar.MONTH, Calendar.JANUARY);
    calendar.set(Calendar.DAY_OF_MONTH, 1);
    calendar.set(Calendar.HOUR_OF_DAY, 0);
    Date start = calendar.getTime();

    calendar.set(Calendar.YEAR, 2014);
    calendar.set(Calendar.MONTH, Calendar.APRIL);
    calendar.set(Calendar.DAY_OF_MONTH, 30);
    calendar.set(Calendar.HOUR_OF_DAY, 23);
    Date end = calendar.getTime();
    //        2013-01-01T00:00:00.000Z/2014-04-30T23:00:00.000Z
    Filter timeFilter = ff.between(ff.property(GdeltFeature.Attributes.SQLDATE.getName()), ff.literal(start),
            ff.literal(end));

    // We'll bound our query spatially to Ukraine
    Filter spatialFilter = ff.bbox(GdeltFeature.Attributes.geom.getName(), 31.6, 44, 37.4, 47.75, "EPSG:4326");

    // we'll also restrict our query to only articles about the US, UK or UN
    Filter attributeFilter = ff.like(ff.property(GdeltFeature.Attributes.Actor1Name.getName()), "UNITED%");

    // Now we can combine our filters using a boolean AND operator
    Filter conjunction = ff.and(Arrays.asList(timeFilter, spatialFilter, attributeFilter));

    return conjunction;
}