List of usage examples for java.util Calendar MINUTE
int MINUTE
To view the source code for java.util Calendar MINUTE.
Click Source Link
get
and set
indicating the minute within the hour. From source file:org.atomspace.ultrahouse3000.translator.Message2DocumentTranslator.java
void addCalenderInformation(Message message) { Calendar cal = Calendar.getInstance(); message.setHeader("timestamp", cal.getTimeInMillis()); message.setHeader("calendarYear", cal.get(Calendar.YEAR)); message.setHeader("calendarDayOfMonth", cal.get(Calendar.DAY_OF_MONTH)); message.setHeader("calendarMonth", cal.get(Calendar.MONTH)); message.setHeader("calendarDayOfYear", cal.get(Calendar.DAY_OF_YEAR)); message.setHeader("calendarHourOfDay", cal.get(Calendar.HOUR_OF_DAY)); message.setHeader("calendarMinute", cal.get(Calendar.MINUTE)); message.setHeader("calendarSecond", cal.get(Calendar.SECOND)); message.setHeader("calendarWeekOfYear", cal.get(Calendar.WEEK_OF_YEAR)); message.setHeader("calendarDayOfWeek", cal.get(Calendar.DAY_OF_WEEK)); }
From source file:com.github.jjYBdx4IL.utils.parser.BerlinAirQualityParserTest.java
@Test public void testParseValueBerlin1Txt() throws IOException, ParseException { @SuppressWarnings("deprecation") String source = IOUtils.toString(getClass().getResourceAsStream("berlin1.txt")); AirQualityParseResult result = parser.setSourceDoc(source).parse().getResult(ID_PM10_VERKEHR); assertEquals(24, Integer.parseInt(result.getValue())); // 01.07.2014 - 11:00 Uhr MESZ assertEquals(2014, result.getTime().get(Calendar.YEAR)); assertEquals(6, result.getTime().get(Calendar.MONTH)); assertEquals(1, result.getTime().get(Calendar.DAY_OF_MONTH)); assertEquals(11, result.getTime().get(Calendar.HOUR)); assertEquals(0, result.getTime().get(Calendar.MINUTE)); assertTrue(result.getDesc().contains("Verkehrsmessstelle")); assertEquals("PM10", result.getType().toString()); }
From source file:io.gatling.jenkins.targetenvgraphs.BuildInfoForTargetEnvGraph.java
public Calendar getGraphEndTime() { Calendar endTime = (Calendar) this.getBuildStartTime().clone(); endTime.setTimeInMillis(endTime.getTimeInMillis() + this.getBuildDuration()); endTime.add(Calendar.MINUTE, BuildInfoForTargetEnvGraph.GRAPH_END_BUFFER_TIME_IN_MINUTES); return endTime; }
From source file:it.generatore.DateRandomGaussianGeneratorTest.java
private static String getHourKey(Calendar cal) { return StringUtils.leftPad(String.valueOf(cal.get(Calendar.HOUR_OF_DAY)), 2, '0') + ":" + StringUtils.leftPad(String.valueOf(cal.get(Calendar.MINUTE)), 2, '0'); }
From source file:de.tor.tribes.ui.components.TimePicker.java
/** * Creates new form TimePicker//from ww w. ja v a2 s.c o m */ public TimePicker(Date pDate) { Calendar cal = Calendar.getInstance(); if (pDate != null) { cal.setTime(pDate); } pHour = cal.get(Calendar.HOUR_OF_DAY); pMinute = cal.get(Calendar.MINUTE); initComponents(); initSpecialComponents(); }
From source file:iddb.web.viewbean.PenaltyViewBean.java
public Date getExpires() { Calendar calendar = new GregorianCalendar(); calendar.setTime(this.created); calendar.add(Calendar.MINUTE, this.getDuration().intValue()); return calendar.getTime(); }
From source file:net.sourceforge.eclipsetrader.borsaitalia.HistoryFeed.java
public void updateHistory(Security security, int interval) { History history = null;// w w w. jav a2 s.com Calendar from = Calendar.getInstance(); from.set(Calendar.MILLISECOND, 0); if (interval < IHistoryFeed.INTERVAL_DAILY) { history = security.getIntradayHistory(); from.set(Calendar.HOUR_OF_DAY, 0); from.set(Calendar.MINUTE, 0); from.set(Calendar.SECOND, 0); log.info("Updating intraday data for " + security.getCode() + " - " + security.getDescription()); //$NON-NLS-1$ //$NON-NLS-2$ } else { history = security.getHistory(); if (history.size() == 0) from.add(Calendar.YEAR, -CorePlugin.getDefault().getPreferenceStore() .getInt(CorePlugin.PREFS_HISTORICAL_PRICE_RANGE)); else { Bar cd = history.getLast(); from.setTime(cd.getDate()); from.add(Calendar.DATE, 1); } log.info("Updating historical data for " + security.getCode() + " - " + security.getDescription()); //$NON-NLS-1$ //$NON-NLS-2$ } String symbol = null; if (security.getHistoryFeed() != null) symbol = security.getHistoryFeed().getSymbol(); if (symbol == null || symbol.length() == 0) symbol = security.getCode(); String code = security.getCode(); if (code.indexOf('.') != -1) code = code.substring(0, code.indexOf('.')); try { String host = "194.185.192.223"; // "grafici.borsaitalia.it"; StringBuffer url = new StringBuffer( "http://" + host + "/scripts/cligipsw.dll?app=tic_d&action=dwnld4push&cod=" + code + "&codneb=" //$NON-NLS-1$//$NON-NLS-2$ + symbol + "&req_type=GRAF_DS&ascii=1&form_id="); if (interval < IHistoryFeed.INTERVAL_DAILY) url.append("&period=1MIN"); //$NON-NLS-1$ else { url.append("&period=1DAY"); //$NON-NLS-1$ url.append("&From=" + df.format(from.getTime())); //$NON-NLS-1$ } log.debug(url); HttpClient client = new HttpClient(); client.getHttpConnectionManager().getParams().setConnectionTimeout(5000); BundleContext context = BorsaitaliaPlugin.getDefault().getBundle().getBundleContext(); ServiceReference reference = context.getServiceReference(IProxyService.class.getName()); if (reference != null) { IProxyService proxy = (IProxyService) context.getService(reference); IProxyData data = proxy.getProxyDataForHost(host, IProxyData.HTTP_PROXY_TYPE); if (data != null) { if (data.getHost() != null) client.getHostConfiguration().setProxy(data.getHost(), data.getPort()); if (data.isRequiresAuthentication()) client.getState().setProxyCredentials(AuthScope.ANY, new UsernamePasswordCredentials(data.getUserId(), data.getPassword())); } } HttpMethod method = new GetMethod(url.toString()); method.setFollowRedirects(true); client.executeMethod(method); BufferedReader in = new BufferedReader(new InputStreamReader(method.getResponseBodyAsStream())); // The first line is the header, ignoring String inputLine = in.readLine(); log.trace(inputLine); while ((inputLine = in.readLine()) != null) { log.trace(inputLine); if (inputLine.startsWith("@") == true || inputLine.length() == 0) //$NON-NLS-1$ continue; String[] item = inputLine.split("\\|"); //$NON-NLS-1$ Bar bar = new Bar(); bar.setDate(df.parse(item[0])); bar.setOpen(Double.parseDouble(item[1])); bar.setHigh(Double.parseDouble(item[2])); bar.setLow(Double.parseDouble(item[3])); bar.setClose(Double.parseDouble(item[4])); bar.setVolume((long) Double.parseDouble(item[5])); // Remove the old bar, if exists int index = history.indexOf(bar.getDate()); if (index != -1) history.remove(index); history.add(bar); } in.close(); } catch (Exception e) { CorePlugin.logException(e); } CorePlugin.getRepository().save(history); }
From source file:com.adsapient.shared.service.TimeService.java
public static final boolean isInBlockTime(String beginTime, String endTime) throws IncorrectDateException { int beginHour; int endHour;//ww w . j av a 2s . c o m int beginMinute; int endMinute; Calendar calendar = Calendar.getInstance(); int currentHour = calendar.get(Calendar.HOUR_OF_DAY); int currentMinute = calendar.get(Calendar.MINUTE); if (StringUtils.isEmpty(beginTime) | StringUtils.isEmpty(endTime)) { throw new IncorrectDateException("Date string is empty."); } StringTokenizer begin = new StringTokenizer(beginTime, ":"); StringTokenizer end = new StringTokenizer(endTime, ":"); if (!begin.hasMoreTokens()) { throw new IncorrectDateException("Begin time was not specified."); } if (!end.hasMoreTokens()) { throw new IncorrectDateException("End time was not specified."); } String tempBH = begin.nextToken(); String tempEH = end.nextToken(); try { beginHour = Integer.parseInt(tempBH); endHour = Integer.parseInt(tempEH); } catch (NumberFormatException e) { throw new IncorrectDateException("Year parameter should be numeric."); } String tempBM = begin.nextToken(); String tempEM = end.nextToken(); try { beginMinute = Integer.parseInt(tempBM); endMinute = Integer.parseInt(tempEM); } catch (NumberFormatException e) { throw new IncorrectDateException("Year parameter should be numeric."); } System.out.println("cur hour" + currentHour + " curr min" + currentMinute); System.out.println("begin time" + beginHour + " begin min" + beginMinute); if ((currentHour > beginHour) | ((currentHour == beginHour) & (currentMinute > beginMinute))) { if ((currentHour < endHour) | ((currentHour == endHour) & (currentMinute < endMinute))) { return true; } } return false; }
From source file:Main.java
private static String doFormatDate(Calendar calendar) { return String.format(Locale.ROOT, "%04d-%02d-%02dT%02d:%02d:%02dZ", calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH) + 1, calendar.get(Calendar.DAY_OF_MONTH), calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE), calendar.get(Calendar.SECOND)); }
From source file:com.ar.dev.tierra.api.dao.impl.NotaCreditoDAOImpl.java
@Override public List<NotaCredito> getDaily() { Criteria criteria = getSession().createCriteria(NotaCredito.class); Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); Date fromDate = calendar.getTime(); calendar.set(Calendar.HOUR_OF_DAY, 23); calendar.set(Calendar.MINUTE, 59); calendar.set(Calendar.SECOND, 59); Date toDate = calendar.getTime(); criteria.add(Restrictions.between("fechaCreacion", fromDate, toDate)); criteria.addOrder(Order.desc("idNotaCredito")); List<NotaCredito> list = criteria.list(); return list;//from ww w .java 2s.c om }