List of usage examples for java.util Calendar HOUR
int HOUR
To view the source code for java.util Calendar HOUR.
Click Source Link
get
and set
indicating the hour of the morning or afternoon. From source file:ezbake.data.elastic.IT_EzElasticIntegrationTest.java
private void loadSamples() { final Calendar visit = new GregorianCalendar(); Visibility aVis = new Visibility().setFormalVisibility("A"); // Washington Monument jeffersonMemorial = new PlaceOfInterest(); jeffersonMemorial.setTitle("Jefferson Memorial"); jeffersonMemorial.setComments(//from www .ja va 2 s .co m "The Thomas Jefferson Memorial is a presidential memorial in Washington, D.C., dedicated to Thomas " + "Jefferson, (17431826), one of the most important of the American \"Founding Fathers\" as " + "the main drafter and writer of the \"Declaration of Independence\", member of the " + "Continental Congress, Governor of the newly independent Commonwealth of Virginia, American" + " minister to King Louis XVI and the Kingdom of France, first U.S. Secretary of State under" + " the first President George Washington, the second Vice President of the United States " + "under second President John Adams, and also the third President of the United States, " + "(18011809)."); jeffersonMemorial.setLocation(new Location(38.889468, -77.03524)); jeffersonMemorial.setRating(92); jeffersonMemorial.setVisit(visit.getTime()); jeffersonMemorialDoc = EzElasticTestUtils.generateDocument(TEST_TYPE, gson.toJson(jeffersonMemorial), aVis); // Columbia columbia = new PlaceOfInterest(); columbia.setTitle("Columbia"); columbia.setComments( "Columbia is a planned community comprising 10 self-contained villages, located in Howard " + "County, Marylandthe second wealthiest county in the United States, according to " + "2013 U.S. Census Bureau figures."); columbia.setLocation(new Location(39.182786, -76.808853)); columbia.setRating(85); visit.add(Calendar.HOUR, -5); columbia.setVisit(visit.getTime()); columbiaDoc = EzElasticTestUtils.generateDocument(TEST_TYPE, gson.toJson(columbia), aVis); //Lincoln Memorial lincolnMemorial = new PlaceOfInterest(); lincolnMemorial.setTitle("Lincoln Memorial"); lincolnMemorial.setComments( "The Lincoln Memorial is an American national monument built to honor the 16th President of the " + "United States, Abraham Lincoln."); lincolnMemorial.setLocation(new Location(38.888481, -77.051518)); lincolnMemorial.setRating(2); visit.add(Calendar.HOUR, -2); lincolnMemorial.setVisit(visit.getTime()); lincolnMemorialDoc = EzElasticTestUtils.generateDocument(TEST_TYPE, gson.toJson(lincolnMemorial), aVis); // White House whiteHouse = new PlaceOfInterest(); whiteHouse.setTitle("White House"); whiteHouse.setComments( "The home of the president of the US located at 1600 Pennsylvania Ave. Since 1800 it has " + "been the home of every US president."); whiteHouse.setLocation(new Location(38.8977, -77.0365)); whiteHouse.setRating(23); visit.add(Calendar.DAY_OF_MONTH, -3); whiteHouse.setVisit(visit.getTime()); whiteHouseDoc = EzElasticTestUtils.generateDocument(TEST_TYPE, gson.toJson(whiteHouse), aVis); }
From source file:com.ecofactor.qa.automation.api.HttpsReportsAPITest.java
/** * Gets the month params./*from w w w . j a v a2s .co m*/ * @param month the month * @return the month params */ private HashMap<String, String> getMonthParams(int month) { HashMap<String, String> params = new HashMap<String, String>(); Calendar start = DateUtil.getUTCCalendar(); start.set(Calendar.MONTH, month - 1); start.set(Calendar.DATE, 1); start.set(Calendar.HOUR, 12); start.set(Calendar.MINUTE, 0); start.set(Calendar.SECOND, 0); start.set(Calendar.AM_PM, 0); Calendar end = DateUtil.getUTCCalendar(); end.set(Calendar.MONTH, month - 1); end.set(Calendar.DATE, end.getMaximum(Calendar.DATE)); end.set(Calendar.HOUR, 12); end.set(Calendar.MINUTE, 0); end.set(Calendar.SECOND, 0); end.set(Calendar.AM_PM, 0); params.put(HttpsReportsAPIConfig.START_DATE, DateUtil.format(start, DateUtil.DATE_FMT)); params.put(HttpsReportsAPIConfig.END_DATE, DateUtil.format(end, DateUtil.DATE_FMT)); params.put(HttpsReportsAPIConfig.INTERVAL, "MONTHS"); return params; }
From source file:com.ecofactor.qa.automation.api.ReportsAPITest.java
/** * Gets the hour params./*from w w w . j a v a 2 s . co m*/ * @return the hour params */ private HashMap<String, String> getHourParams() { HashMap<String, String> params = new HashMap<String, String>(); Calendar start = DateUtil.getUTCCalendar(); start.set(Calendar.DAY_OF_MONTH, 25); start.set(Calendar.MONTH, 4); start.set(Calendar.HOUR, 12); start.set(Calendar.MINUTE, 0); start.set(Calendar.SECOND, 0); start.set(Calendar.AM_PM, 0); params.put(ReportsAPIConfig.START_DATE, DateUtil.format(start, DateUtil.DATE_FMT)); params.put(ReportsAPIConfig.END_DATE, DateUtil.format(start, DateUtil.DATE_FMT)); params.put(ReportsAPIConfig.INTERVAL, "HOURS"); return params; }
From source file:com.ecofactor.qa.automation.api.HttpsReportsAPITest.java
/** * Gets the hour params./* w w w .ja v a 2s . c o m*/ * @return the hour params */ private HashMap<String, String> getHourParams() { HashMap<String, String> params = new HashMap<String, String>(); Calendar start = DateUtil.getUTCCalendar(); start.set(Calendar.DAY_OF_MONTH, 25); start.set(Calendar.MONTH, 4); start.set(Calendar.HOUR, 12); start.set(Calendar.MINUTE, 0); start.set(Calendar.SECOND, 0); start.set(Calendar.AM_PM, 0); params.put(HttpsReportsAPIConfig.START_DATE, DateUtil.format(start, DateUtil.DATE_FMT)); params.put(HttpsReportsAPIConfig.END_DATE, DateUtil.format(start, DateUtil.DATE_FMT)); params.put(HttpsReportsAPIConfig.INTERVAL, "HOURS"); return params; }
From source file:de.bangl.lm.LotManagerPlugin.java
public void getInactiveLotList(CommandSender sender) { try {//from w w w . j a v a2 s .c o m if (this.hasEssentials) { Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); cal.add(Calendar.HOUR, -(24 * 7 * 2)); // Vor vier Wochen cal.set(Calendar.HOUR, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); Boolean foundone = false; for (World world : this.getServer().getWorlds()) { for (Lot lot : this.lots.getAllLots().values()) { final ProtectedRegion wgregion = this.wg.getRegionManager(world).getRegion(lot.getId()); if (wgregion != null) { DefaultDomain owners = wgregion.getOwners(); if (owners != null) { for (UUID player : owners.getUniqueIds()) { User essuser = this.ess.getUser(player); if (essuser != null) { final Date lastonline = new Date(essuser.getLastLogin()); if (lastonline.before(cal.getTime())) { this.sendInfo(sender, lot.getId() + " - " + essuser.getDisplayName() + " (" + lastonline.toString() + ")"); foundone = true; } } } } } } } if (!foundone) { this.sendInfo(sender, "All lots given away seem to be actively used."); } } else { sendError(sender, "Sorry, you need \"Essentials\" to use this feature."); } } catch (Exception e) { logError(e.getMessage()); sendError(sender, e.getMessage()); } }
From source file:com.rogchen.common.xml.UtilDateTime.java
public static Date plusHour(Date date, int plusWeek) { return plusInteger(date, Calendar.HOUR, plusWeek); }
From source file:com.concursive.connect.web.modules.calendar.utils.CalendarView.java
/** * Returns an ArrayList of CalendarEventLists which contain CalendarEvents, * including all of today's events.<p> * <p/>/*w w w . j ava2 s.c om*/ * A full day is always returned, if the events do not add up to (max) then * the next days is included. Scans up to 31 days. * * @param max Description of Parameter * @return The Events value */ public ArrayList getEvents(int max) { ArrayList<CalendarEventList> allDays = new ArrayList<CalendarEventList>(); int count = 0; int loopCount = 0; int dayCount = 0; Calendar tmpCal = Calendar.getInstance(timeZone, locale); tmpCal.set(Calendar.HOUR, 0); tmpCal.set(Calendar.MINUTE, 0); tmpCal.set(Calendar.SECOND, 0); tmpCal.set(Calendar.MILLISECOND, 0); if (calendarInfo != null) { if (calendarInfo.isAgendaView()) { dayCount = AGENDA_DAY_COUNT; } else if (calendarInfo.getCalendarView().equalsIgnoreCase("day")) { dayCount = 1; tmpCal.set(calendarInfo.getYearSelected(), calendarInfo.getMonthSelected() - 1, calendarInfo.getDaySelected()); } else if (calendarInfo.getCalendarView().equalsIgnoreCase("week")) { dayCount = 7; tmpCal.set(calendarInfo.getYearSelected(), calendarInfo.getStartMonthOfWeek() - 1, calendarInfo.getStartDayOfWeek()); } else if (calendarInfo.getCalendarView().equals("month")) { dayCount = getEndCell(cal); tmpCal.set(calendarInfo.getYearSelected(), calendarInfo.getMonthSelected() - 1, 1); } } while (count < max && loopCount < dayCount) { CalendarEventList thisEventList = getDaysEvents(tmpCal.get(Calendar.MONTH), tmpCal.get(Calendar.DAY_OF_MONTH), tmpCal.get(Calendar.YEAR)); if (thisEventList.size() > 0) { thisEventList.setDate(DateUtils.getDate(tmpCal)); allDays.add(thisEventList); } tmpCal.add(java.util.Calendar.DATE, +1); loopCount++; count++; } return allDays; }
From source file:com.aimluck.eip.schedule.util.ScheduleUtils.java
/** * ??2???/*from ww w. j av a 2 s . co m*/ * * @param date1 * @param date2 * @param checkTime * ????true * @return ???true */ public static boolean equalsToDate(Date date1, Date date2, boolean checkTime) { Calendar cal = Calendar.getInstance(); cal.setTime(date1); int date1Year = cal.get(Calendar.YEAR); int date1Month = cal.get(Calendar.MONTH) + 1; int date1Day = cal.get(Calendar.DATE); int date1Hour = cal.get(Calendar.HOUR); int date1Minute = cal.get(Calendar.MINUTE); cal.setTime(date2); int date2Year = cal.get(Calendar.YEAR); int date2Month = cal.get(Calendar.MONTH) + 1; int date2Day = cal.get(Calendar.DATE); int date2Hour = cal.get(Calendar.HOUR); int date2Minute = cal.get(Calendar.MINUTE); if (checkTime) { if (date1Year == date2Year && date1Month == date2Month && date1Day == date2Day && date1Hour == date2Hour && date1Minute == date2Minute) { return true; } } else { if (date1Year == date2Year && date1Month == date2Month && date1Day == date2Day) { return true; } } return false; }
From source file:com.rogchen.common.xml.UtilDateTime.java
public static Date addHour(Date date, int amount) { return addInteger(date, Calendar.HOUR, amount); }
From source file:com.concursive.connect.web.modules.calendar.utils.CalendarView.java
/** * Sets the Calendar with the required attributes. Creation date: (5/2/2000 * 3:06:38 AM)//from w w w. java2 s.c om */ public void update() { cal.set(Calendar.HOUR, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); cal.set(year, month, day); calPrev.set(Calendar.HOUR, 0); calPrev.set(Calendar.MINUTE, 0); calPrev.set(Calendar.SECOND, 0); calPrev.set(Calendar.MILLISECOND, 0); calPrev.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), 1); calPrev.add(Calendar.MONTH, -1); calNext.set(Calendar.HOUR, 0); calNext.set(Calendar.MINUTE, 0); calNext.set(Calendar.SECOND, 0); calNext.set(Calendar.MILLISECOND, 0); calNext.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), 1); calNext.add(Calendar.MONTH, 1); }