public DateTimeRenderer() { super(); dateFormatter = (SimpleDateFormat) SimpleDateFormat.getInstance(); //log.info("Simple inst"); }
public DateTimeRenderer() { super(); dateFormatter = (SimpleDateFormat) SimpleDateFormat.getInstance(); //log.info("Simple inst"); }
@Override public boolean callBack(View v, @NonNull Date selectedDate) { tvResult.setText(SimpleDateFormat.getInstance().format(selectedDate)); return false; } });
public void onMessage(Message message) { try { DateFormat dateFormat = SimpleDateFormat.getInstance(); String date = dateFormat.format(new Date()); if (message instanceof TextMessage) { TextMessage textMessage = (TextMessage) message; System.out.println(date + " " + textMessage.getText()); } else { ObjectMessage objectMessage = (ObjectMessage) message; System.out.println(date + " " + objectMessage.getObject()); } } catch (JMSException ex) { System.out.println("Error reading text message:" + ex); } } }
private boolean checkDiff(String repoid,long amount) { Date date = RepositoryPreferences.getInstance().getLastIndexUpdate(repoid); Date now = new Date(); LOGGER.finer("Check Date Diff :"+repoid);//NOI18N LOGGER.finer("Last Indexed Date :"+SimpleDateFormat.getInstance().format(date));//NOI18N LOGGER.finer("Now :"+SimpleDateFormat.getInstance().format(now));//NOI18N long diff = now.getTime() - date.getTime(); LOGGER.finer("Diff :"+diff);//NOI18N return (diff < 0 || diff > amount); }
@Override public Node parse(Element e) { // String format = e.attributeValue(JRSTLexer.DIRECTIVE_VALUE); // TODO used format to format date, this format is not Java standard // is python standard "%Y-%m-%d" Text result = DocumentHelper.createText(SimpleDateFormat.getInstance() .format(new Date())); return result; }
@Override public String toString() { String formattedTime = SimpleDateFormat.getInstance().format(new Date(time)); return datasetName+": "+super.toString()+" ("+cellName+") @"+formattedTime+"-"+resolution; }
private void setImageDefaults(Map properties) { if (properties.get("logarithmic") == null) { properties.put("logarithmic", "false"); } DateFormat format = SimpleDateFormat.getInstance(); if (properties.get("intervalstart") != null && properties.get("intervalend") != null) { Long start = (Long) properties.get("intervalstart"); Long end = (Long) properties.get("intervalend"); Date startDate = new Date(start.longValue() * 1000); Date endDate = new Date(end.longValue() * 1000); properties.put("generatedstamp", "Monitoring period: " + format.format(startDate) + " - " + format.format(endDate) + " [Generated " + format.format(new Date()) + "]\\r"); } else { properties.put("generatedstamp", "Generated " + format.format(new Date()) + "\\r"); } if (properties.get("imagetitle") == null) { properties.put("imagetitle", "Current performance results"); } }
public void started() { jButtonStop.setEnabled(true); jButtonStart.setEnabled(false); panelStartTest.setValue(SimpleDateFormat.getInstance().format(new Date())); }
public void started() { stopButton.setEnabled(true); startButton.setEnabled(false); startedAt.setValue(SimpleDateFormat.getInstance().format(new Date())); }
public void refreshView() { ArrayList<String> lines = new ArrayList<String>(); lines.add("not committed documents:\t" + String.valueOf(updateExecutor.getNotCommitedDocuments())); if(commitHistoryStatistic.getLastCommitDate() != null) { lines.add("last commit:\t" + SimpleDateFormat.getInstance().format(commitHistoryStatistic.getLastCommitDate())); } lines.add("total commits:\t" + String.valueOf(commitHistoryStatistic.getTotalCommits())); lines.add("errors on commit:\t" + String.valueOf(commitHistoryStatistic.getCommitErrorCount())); HeadlessUtils.outputData("commitConsolePanel.title", HeadlessConsoleFrame.getOutputDirectory(), lines); }
public void refreshView() { panelNotCommitedDocuments.setValue(String.valueOf(updateExecutor.getNotCommitedDocuments())); if(commitHistoryStatistic.getLastCommitDate() != null) { panelLastCommit.setValue(SimpleDateFormat.getInstance().format(commitHistoryStatistic.getLastCommitDate())); } panelNumberOfCommits.setValue(String.valueOf(commitHistoryStatistic.getTotalCommits())); panelErrorsOnCommit.setValue(String.valueOf(commitHistoryStatistic.getCommitErrorCount())); }
@Override public void refreshView() { logger.debug("refreshing Full Query Statistics"); ArrayList<String> lines = new ArrayList<String>(); lines.add("median:\t" + getString(fullQueryStatistic.getMedian())); lines.add("mode:\t" + fullQueryStatistic.getMode().toString()); lines.add("variance:\t" + getString(fullQueryStatistic.getVariance())); lines.add("standard deviation:\t" + getString(fullQueryStatistic.getStandardDeviation())); lines.add("total average:\t" + fullQueryStatistic.getTotaAverage().toString()); lines.add("last minute average:\t" + fullQueryStatistic.getLastMinuteAverage().toString()); lines.add("last ten minute average:\t" + fullQueryStatistic.getLastTenMinutesAverage().toString()); if(fullQueryStatistic.getLastErrorTime() != null) { lines.add("last error time:\t" + SimpleDateFormat.getInstance().format(fullQueryStatistic.getLastErrorTime())); } else { lines.add("last error time:\t-"); } lines.add("status\tquery\tfilter query\tfacet query\tquery time\tresult count"); List<QueryLogStatistic.QueryLogValue> queries = queryLogStatistic.getLastQueries(); for(QueryLogStatistic.QueryLogValue value:queries) { lines.add(prepareData(value.getCSV())); } HeadlessUtils.outputData(PREFIX + "title", HeadlessConsoleFrame.getStatisticsOutputDirectory(), lines); }
@Override public Converter create(BeanProperty property, Genson genson) { JsonDateFormat ann = property.getAnnotation(JsonDateFormat.class); if (ann != null) { Locale locale = ann.lang().isEmpty() ? Locale.getDefault() : new Locale( ann.lang()); DateFormat dateFormat = ann.value() != null && !ann.value().isEmpty() ? new SimpleDateFormat(ann.value(), locale) : SimpleDateFormat.getInstance(); if (Date.class.isAssignableFrom(property.getRawClass())) return new DateConverter(dateFormat, ann.asTimeInMillis()); if (Calendar.class.isAssignableFrom(property.getRawClass())) return new CalendarConverter( new DateConverter(dateFormat, ann.asTimeInMillis())); } return null; } }
public void scanningStarted(IndexingContext ctx) { handle = ProgressHandleFactory.createHandle("Indexing Repo : " + (ri!=null? ri.getName() : indexingContext.getId())); if (debug) { writer.println("Indexing Repo : " + (ri!=null? ri.getName():ctx.getId())); writer.println("Index Directory : " + ctx.getIndexDirectory().toString()); writer.println("--------------------------------------------------------"); writer.println("Scanning started at " + SimpleDateFormat.getInstance().format(new Date())); } handle.start(); handle.switchToIndeterminate(); tstart = System.currentTimeMillis(); }
public void scanningFinished(IndexingContext ctx, ScanningResult result) { if (debug) { writer.println("Scanning ended at " + SimpleDateFormat.getInstance().format(new Date())); if (result.hasExceptions()) { writer.printf("Total scanning errors: %s\n", result.getExceptions().size()); } writer.printf("Total files scanned: %s\n", result.getTotalFiles()); long t = System.currentTimeMillis() - tstart; long s = t / 1000L; if (t > 60 * 1000) { long m = t / 1000L / 60L; writer.printf("Total time: %d min %d sec\n", m, s - (m * 60)); } else { writer.printf("Total time: %d sec\n", s); } } if (createZip) { SimpleDateFormat df = new SimpleDateFormat( IndexingContext.INDEX_TIME_FORMAT ); Properties info = new Properties(); info.setProperty( IndexingContext.INDEX_FILE, df.format( ctx.getTimestamp() ) ); writeIndexInfo( info ); createIndexArchive(); } handle.finish(); }
@Override public Converter create(BeanProperty property, Genson genson) { JsonDateFormat ann = property.getAnnotation(JsonDateFormat.class); if (ann != null) { Locale locale = ann.lang().isEmpty() ? Locale.getDefault() : new Locale( ann.lang()); DateFormat dateFormat = ann.value() != null && !ann.value().isEmpty() ? new SimpleDateFormat(ann.value(), locale) : SimpleDateFormat.getInstance(); if (Date.class.isAssignableFrom(property.getRawClass())) return new DateConverter(dateFormat, ann.asTimeInMillis()); if (Calendar.class.isAssignableFrom(property.getRawClass())) return new CalendarConverter( new DateConverter(dateFormat, ann.asTimeInMillis())); } return null; } }
@Override public void refreshView() { logger.debug("refreshing Full Query Statistics"); medianInfoPanel.setValue(getString(fullQueryStatistic.getMedian())); modeInfoPanel.setValue(fullQueryStatistic.getMode().toString()); varianceInfoPanel.setValue(getString(fullQueryStatistic.getVariance())); standardDeviationInfoPanel.setValue(getString(fullQueryStatistic.getStandardDeviation())); totalAverageInfoPanel.setValue(fullQueryStatistic.getTotaAverage().toString()); lastMinuteAverageInfoPanel.setValue(fullQueryStatistic.getLastMinuteAverage().toString()); lastTenMinutesAverageInfoPanel.setValue(fullQueryStatistic.getLastTenMinutesAverage().toString()); if(fullQueryStatistic.getLastErrorTime() != null) { lastErrorInfoPanel.setValue(SimpleDateFormat.getInstance().format(fullQueryStatistic.getLastErrorTime())); } else { lastErrorInfoPanel.setValue("-"); } if(!scrollLockButton.isSelected()) { ((QueryLogTableModel)logTable.getModel()).refreshData(queryLogStatistic.getLastQueries()); } }
private static void runAssertionDateformatNonString(RegressionEnvironment env, AtomicInteger milestone) { SupportDateTime sdt = SupportDateTime.make("2002-05-30T09:00:00.000"); String sdfDate = SimpleDateFormat.getInstance().format(sdt.getUtildate()); String ldtDate = sdt.getLocaldate().format(DateTimeFormatter.ISO_DATE_TIME); String zdtDate = sdt.getZoneddate().format(DateTimeFormatter.ISO_ZONED_DATE_TIME); String ldDate = sdt.getLocaldate().toLocalDate().format(DateTimeFormatter.ISO_DATE); String ltDate = sdt.getLocaldate().toLocalTime().format(DateTimeFormatter.ISO_TIME); String epl = "@name('s0') select " + "cast('" + sdfDate + "',date,dateformat:SimpleDateFormat.getInstance()) as c0," + "cast('" + sdfDate + "',calendar,dateformat:SimpleDateFormat.getInstance()) as c1," + "cast('" + sdfDate + "',long,dateformat:SimpleDateFormat.getInstance()) as c2," + "cast('" + ldtDate + "',localdatetime,dateformat:java.time.format.DateTimeFormatter.ISO_DATE_TIME) as c3," + "cast('" + zdtDate + "',zoneddatetime,dateformat:java.time.format.DateTimeFormatter.ISO_ZONED_DATE_TIME) as c4," + "cast('" + ldDate + "',localdate,dateformat:java.time.format.DateTimeFormatter.ISO_DATE) as c5," + "cast('" + ltDate + "',localtime,dateformat:java.time.format.DateTimeFormatter.ISO_TIME) as c6" + " from SupportBean"; env.compileDeployAddListenerMile(epl, "s0", milestone.getAndIncrement()); env.sendEventBean(new SupportBean()); EventBean event = env.listener("s0").assertOneGetNewAndReset(); EPAssertionUtil.assertProps(event, "c0,c1,c2,c3,c4,c5,c6".split(","), new Object[]{sdt.getUtildate(), sdt.getCaldate(), sdt.getLongdate(), sdt.getLocaldate(), sdt.getZoneddate(), sdt.getLocaldate().toLocalDate(), sdt.getLocaldate().toLocalTime()}); env.undeployAll(); }
private void history(String[] args) throws Exception { OptionParser p = getOptionParser(); p.accepts(OPT_RESOURCE_ID, "The resource id to get actions for"). withRequiredArg().ofType(Integer.class); OptionSet options = getOptions(p, args); HQApi api = getApi(options); ResourceApi rApi = api.getResourceApi(); ControlApi cApi = api.getControlApi(); Integer resourceId = (Integer)getRequired(options, OPT_RESOURCE_ID); ResourceResponse resourceResponse = rApi.getResource(resourceId, false, false); checkSuccess(resourceResponse); ControlHistoryResponse response = cApi.getHistory(resourceResponse.getResource()); checkSuccess(response); System.out.println("Control history for " + resourceResponse.getResource().getName()); final DateFormat df = SimpleDateFormat.getInstance(); for (ControlHistory h : response.getControlHistory()) { System.out.println(df.format(new Date(h.getStartTime())) + " action=" + h.getAction() + " dur=" + (h.getEndTime() - h.getStartTime()) + " status=" + h.getStatus()); } }