List of usage examples for org.joda.time DateTimeFieldType minuteOfHour
public static DateTimeFieldType minuteOfHour()
From source file:com.google.code.tickconverter.convert.ConvertAdapter.java
License:Open Source License
/** * This method is the main method of the convert process. While the {@link BlockingQueue} of {@link IDukascopyRO} * have for 10 seconds no objects in the {@link BlockingQueue} add this method this object into the * {@link MetatraderConverter}. If an {@link InvalidTimeException} will threw the converter put a new * {@link MetatraderBean} into the {@link BlockingQueue} of {@link IMetatraderRO} and get the information of the * values from the {@link MetatraderConverter} object. * /*from w ww .j a va2s .c o m*/ * @throws InterruptedException will threw if {@link Thread#interrupt()} is called in the poll phase * @throws InvalidTimeException will threw if {@link MetatraderConverter#incrementInterval()} have a low range for * the new object after the creation of a new {@link MetatraderBean} */ public void convertProcess() throws InterruptedException { while (true) { IDukascopyRO object = dukaQueue.poll(2, TimeUnit.SECONDS); LoggerUtils.createDebugLog("poll object: " + object); if (null == object) { if (null != converter && converter.hasElements()) { putMetatraderObject(); } break; } if (null == converter) { DateTime timestamp = object.getTimeStamp(); DateTime start = new DateTime(timestamp.get(DateTimeFieldType.year()), timestamp.get(DateTimeFieldType.monthOfYear()), timestamp.get(DateTimeFieldType.dayOfMonth()), timestamp.get(DateTimeFieldType.hourOfDay()), timestamp.get(DateTimeFieldType.minuteOfHour())); converter = new MetatraderConverter(start, Period.minutes(1)); } try { converter.addDukascopy(object); } catch (InvalidTimeException e) { putMetatraderObject(); incrementWhileAdd(object); } } }
From source file:de.avanux.smartapplianceenabler.appliance.TimeOfDay.java
License:Open Source License
public TimeOfDay(LocalDateTime dateTime) { hour = dateTime.get(DateTimeFieldType.hourOfDay()); minute = dateTime.get(DateTimeFieldType.minuteOfHour()); second = dateTime.get(DateTimeFieldType.secondOfMinute()); }
From source file:de.openali.odysseus.chart.ext.base.axisrenderer.provider.DateTimeAxisFieldProvider.java
License:Open Source License
@Override public IDateTimeAxisField getDateTimeAxisField(final IDataRange<Number> range) { final long dr = range.getMax().longValue() - range.getMin().longValue(); final long sec = 1000; final long min = 60 * sec; final long hour = 60 * min; final long day = 24 * hour; if (dr < 3 * sec) return new DateTimeAxisField(DateTimeFieldType.millisOfSecond(), "YYYY.dd.MM\nHH:mm:ss:SSS", //$NON-NLS-1$ new int[] { 1, 10, 100, 500 }, new int[] {}); else if (dr < 3 * min) return new DateTimeAxisField(DateTimeFieldType.secondOfMinute(), "YY.dd.MM\nHH:mm:ss", //$NON-NLS-1$ new int[] { 1, 15, 30 }, new int[] {}); else if (dr < 3 * hour) return new DateTimeAxisField(DateTimeFieldType.minuteOfHour(), "YY.dd.MM\nHH:mm:ss", //$NON-NLS-1$ new int[] { 1, 15, 30 }, new int[] {}); else if (dr < 3 * day) return new DateTimeAxisField(DateTimeFieldType.minuteOfDay(), "dd.MM\nHH:mm", new int[] { 1, 15, 30 }, //$NON-NLS-1$ new int[] {}); else if (dr < 7 * day) return new DateTimeAxisField(DateTimeFieldType.hourOfDay(), "dd.MM\nHH:mm", //$NON-NLS-1$ new int[] { 1, 2, 4, 6, 8, 12 }, new int[] { 12 }); else if (dr < 30 * day) return new DateTimeAxisField(DateTimeFieldType.dayOfMonth(), "YYYY.dd.MM\ndddd", //$NON-NLS-1$ new int[] { 1, 2, 7, 14 }, new int[] { 7, 14, 28 }); else//from w ww . ja va 2 s . com return new DateTimeAxisField(DateTimeFieldType.monthOfYear(), "YYYY.dd.MM", new int[] { 1, 2, 3, 4, 6 }, //$NON-NLS-1$ new int[] { 6 }); }
From source file:ee.ut.soras.ajavtV2.mudel.ajavaljend.arvutus.TimeMLDateTimePoint.java
License:Open Source License
public void setField(Granulaarsus field, int value) { // ------ Time if (field == Granulaarsus.AM_PM) { try {// www . j a va2 s . c om this.underlyingTime = (this.underlyingTime).withField(DateTimeFieldType.halfdayOfDay(), value); updateTimeRepresentation(field, null, false, SET_TYPE_OPERATION); } catch (Exception e) { } } if (field == Granulaarsus.HOUR_OF_HALF_DAY) { try { if (value == 12) { value = 0; } this.underlyingTime = (this.underlyingTime).withField(DateTimeFieldType.hourOfHalfday(), value); // NB! Tunni seadistamisel nullime ka minutid, et ei tekiks nt ankurdamisel kummalisi vrtuseid this.underlyingTime = (this.underlyingTime).withField(DateTimeFieldType.minuteOfHour(), 0); updateTimeRepresentation(field, null, false, SET_TYPE_OPERATION); } catch (Exception e) { } } if (field == Granulaarsus.MINUTE) { try { this.underlyingTime = (this.underlyingTime).withField(DateTimeFieldType.minuteOfHour(), value); updateTimeRepresentation(field, null, false, SET_TYPE_OPERATION); } catch (Exception e) { } } // ------ Kuup2evad ja n2dalad if (field == Granulaarsus.DAY_OF_WEEK) { try { this.underlyingDate = (this.underlyingDate).withField(DateTimeFieldType.dayOfWeek(), value); dateModified = true; updateDateRepresentation(field, null, false, SET_TYPE_OPERATION); } catch (Exception e) { } } if (field == Granulaarsus.WEEK_OF_YEAR) { try { this.underlyingDate = (this.underlyingDate).withField(DateTimeFieldType.weekOfWeekyear(), value); dateModified = true; updateDateRepresentation(field, null, false, SET_TYPE_OPERATION); } catch (Exception e) { } } if (field == Granulaarsus.DAY_OF_MONTH) { try { this.underlyingDate = (this.underlyingDate).withField(DateTimeFieldType.dayOfMonth(), value); dateModified = true; updateDateRepresentation(field, null, false, SET_TYPE_OPERATION); } catch (Exception e) { } } if (field == Granulaarsus.MONTH) { try { this.underlyingDate = (this.underlyingDate).withField(DateTimeFieldType.monthOfYear(), value); dateModified = true; updateDateRepresentation(field, null, false, SET_TYPE_OPERATION); } catch (Exception e) { } } if (field == Granulaarsus.YEAR) { try { this.underlyingDate = (this.underlyingDate).withField(DateTimeFieldType.year(), value); dateModified = true; updateDateRepresentation(field, null, false, SET_TYPE_OPERATION); } catch (Exception e) { } } if (field == Granulaarsus.YEAR_OF_CENTURY) { try { this.underlyingDate = (this.underlyingDate).withField(DateTimeFieldType.yearOfCentury(), value); dateModified = true; // NB! Toimib nagu tavalise aastaarvu muutmine updateDateRepresentation(field, null, false, SET_TYPE_OPERATION); } catch (Exception e) { } } if (field == Granulaarsus.CENTURY_OF_ERA) { try { this.underlyingDate = (this.underlyingDate).withField(DateTimeFieldType.centuryOfEra(), value); dateModified = true; updateDateRepresentation(field, null, false, SET_TYPE_OPERATION); } catch (Exception e) { } } }
From source file:net.karlmartens.platform.datatable.DataTableCell.java
License:Apache License
private static JsonElement creasteJsonElement(Object o) { if (o == null) return JsonNull.INSTANCE; if (o instanceof String) return new JsonPrimitive((String) o); if (o instanceof Boolean) return new JsonPrimitive((Boolean) o); if (o instanceof Number) return new JsonPrimitive((Number) o); if (o instanceof BaseLocal) { final BaseLocal date = (BaseLocal) o; final JsonObject json = new JsonObject(); json.add("year", createJsonElement(DateTimeFieldType.year(), date)); json.add("month", createJsonElement(DateTimeFieldType.monthOfYear(), date)); json.add("day", createJsonElement(DateTimeFieldType.dayOfMonth(), date)); json.add("hour", createJsonElement(DateTimeFieldType.hourOfDay(), date)); json.add("minute", createJsonElement(DateTimeFieldType.minuteOfHour(), date)); json.add("second", createJsonElement(DateTimeFieldType.secondOfMinute(), date)); json.add("millis", createJsonElement(DateTimeFieldType.millisOfSecond(), date)); return json; }// www.jav a 2 s. c o m throw new UnsupportedOperationException(); }
From source file:net.sourceforge.fenixedu.domain.Summary.java
License:Open Source License
private void fillSummaryWithInfo(MultiLanguageString title, MultiLanguageString summaryText, Integer studentsNumber, Boolean isExtraLesson, Professorship professorship, String teacherName, Teacher teacher, Shift shift, Lesson lesson, YearMonthDay day, Space room, Partial hour, ShiftType type, Boolean taught) {/*ww w. j a v a2 s . co m*/ setShift(shift); setSummaryDateYearMonthDay(day); setExecutionCourse(shift.getExecutionCourse()); setTitle(title); setSummaryText(summaryText); setIsExtraLesson(isExtraLesson); checkSpecialParameters(isExtraLesson, professorship, teacherName, teacher, lesson, hour, type); checkIfInternalTeacherHasProfessorhipInExecutionCourse(teacher, shift.getExecutionCourse()); checkIfSummaryDateIsValid(day, shift.getExecutionPeriod(), lesson, isExtraLesson); setStudentsNumber(studentsNumber); setProfessorship(professorship); setTeacherName(teacherName); setTeacher(teacher); setLastModifiedDateDateTime(new DateTime()); setSummaryType(type); setTaught(taught); if (isExtraLesson) { super.setLessonInstance(null); setRoom(room); HourMinuteSecond hourMinuteSecond = new HourMinuteSecond(hour.get(DateTimeFieldType.hourOfDay()), hour.get(DateTimeFieldType.minuteOfHour()), 0); setSummaryHourHourMinuteSecond(hourMinuteSecond); } else { setRoom(lesson.getSala()); setSummaryHourHourMinuteSecond(lesson.getBeginHourMinuteSecond()); lessonInstanceManagement(lesson, day, lesson.getSala()); if (getLessonInstance() == null) { throw new DomainException("error.Summary.empty.LessonInstances"); } } }
From source file:net.sourceforge.fenixedu.presentationTier.Action.teacher.SummariesManagementDA.java
License:Open Source License
public ActionForward prepareEditSummary(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws FenixServiceException { Professorship teacherLogged = ((Professorship) request.getAttribute("loggedTeacherProfessorship")); DynaActionForm dynaActionForm = (DynaActionForm) form; Summary summary = getSummaryFromParameter(request); SummaryType summaryType;/*from www .ja v a 2s. co m*/ if (summary.isExtraSummary()) { summaryType = SummaryType.EXTRA_SUMMARY; request.setAttribute("notShowLessonPlanningsAndSummaries", Boolean.TRUE); } else { summaryType = SummaryType.NORMAL_SUMMARY; } DateTimeFieldType[] dateTimeFieldTypes = { DateTimeFieldType.hourOfDay(), DateTimeFieldType.minuteOfHour() }; HourMinuteSecond time = summary.getSummaryHourHourMinuteSecond(); int[] timeArray = { time.getHour(), time.getMinuteOfHour() }; Partial timePartial = new Partial(dateTimeFieldTypes, timeArray); SummariesManagementBean bean = new SummariesManagementBean(summary.getTitle(), summary.getSummaryText(), summary.getStudentsNumber(), summaryType, summary.getProfessorship(), summary.getTeacherName(), summary.getTeacher(), summary.getShift(), summary.getLesson(), summary.getSummaryDateYearMonthDay(), summary.getRoom(), timePartial, summary, teacherLogged, summary.getSummaryType(), summary.getTaught()); return goToSummaryManagementPageAgain(mapping, request, dynaActionForm, bean); }
From source file:org.apache.tajo.util.TimeStampUtil.java
License:Apache License
public static long getMinute(DateTime dateTime) { return convertToMicroSeconds(dateTime.withTime(dateTime.get(DateTimeFieldType.clockhourOfDay()), dateTime.get(DateTimeFieldType.minuteOfHour()), 0, 0)); }
From source file:org.apache.tajo.util.TimeStampUtil.java
License:Apache License
public static long getSecond(DateTime dateTime) { return convertToMicroSeconds(dateTime.withTime(dateTime.get(DateTimeFieldType.clockhourOfDay()), dateTime.get(DateTimeFieldType.minuteOfHour()), dateTime.get(DateTimeFieldType.secondOfMinute()), 0));//from w w w .j av a 2 s . co m }
From source file:org.codelibs.elasticsearch.common.joda.Joda.java
License:Apache License
public static FormatDateTimeFormatter getStrictStandardDateFormatter() { // 2014/10/10 DateTimeFormatter shortFormatter = new DateTimeFormatterBuilder() .appendFixedDecimal(DateTimeFieldType.year(), 4).appendLiteral('/') .appendFixedDecimal(DateTimeFieldType.monthOfYear(), 2).appendLiteral('/') .appendFixedDecimal(DateTimeFieldType.dayOfMonth(), 2).toFormatter().withZoneUTC(); // 2014/10/10 12:12:12 DateTimeFormatter longFormatter = new DateTimeFormatterBuilder() .appendFixedDecimal(DateTimeFieldType.year(), 4).appendLiteral('/') .appendFixedDecimal(DateTimeFieldType.monthOfYear(), 2).appendLiteral('/') .appendFixedDecimal(DateTimeFieldType.dayOfMonth(), 2).appendLiteral(' ') .appendFixedSignedDecimal(DateTimeFieldType.hourOfDay(), 2).appendLiteral(':') .appendFixedSignedDecimal(DateTimeFieldType.minuteOfHour(), 2).appendLiteral(':') .appendFixedSignedDecimal(DateTimeFieldType.secondOfMinute(), 2).toFormatter().withZoneUTC(); DateTimeFormatterBuilder builder = new DateTimeFormatterBuilder() .append(longFormatter.withZone(DateTimeZone.UTC).getPrinter(), new DateTimeParser[] { longFormatter.getParser(), shortFormatter.getParser(), new EpochTimeParser(true) }); return new FormatDateTimeFormatter("yyyy/MM/dd HH:mm:ss||yyyy/MM/dd||epoch_millis", builder.toFormatter().withZone(DateTimeZone.UTC), Locale.ROOT); }