org.joda.time.LocalTime.getHourOfDay()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(205)

本文整理了Java中org.joda.time.LocalTime.getHourOfDay()方法的一些代码示例,展示了LocalTime.getHourOfDay()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LocalTime.getHourOfDay()方法的具体详情如下:
包路径:org.joda.time.LocalTime
类名称:LocalTime
方法名:getHourOfDay

LocalTime.getHourOfDay介绍

[英]Get the hour of day field value.
[中]获取一天中的小时字段值。

代码示例

代码示例来源:origin: joda-time/joda-time

/**
 * Returns a copy of this datetime with the specified time, retaining the date fields.
 * <p>
 * If the new time is invalid due to the time-zone, the time will be adjusted.
 * <p>
 * This instance is immutable and unaffected by this method call.
 *
 * @param time  the local time
 * @return a copy of this datetime with a different time
 * @throws IllegalArgumentException if the time-of-day is invalid for the date
 * @throws NullPointerException if the time is null
 */
public DateTime withTime(LocalTime time) {
  return withTime(
    time.getHourOfDay(), time.getMinuteOfHour(), time.getSecondOfMinute(), time.getMillisOfSecond());
}

代码示例来源:origin: JodaOrg/joda-time

/**
 * Returns a copy of this datetime with the specified time, retaining the date fields.
 * <p>
 * If the new time is invalid due to the time-zone, the time will be adjusted.
 * <p>
 * This instance is immutable and unaffected by this method call.
 *
 * @param time  the local time
 * @return a copy of this datetime with a different time
 * @throws IllegalArgumentException if the time-of-day is invalid for the date
 * @throws NullPointerException if the time is null
 */
public DateTime withTime(LocalTime time) {
  return withTime(
    time.getHourOfDay(), time.getMinuteOfHour(), time.getSecondOfMinute(), time.getMillisOfSecond());
}

代码示例来源:origin: joda-time/joda-time

return new DateTime(
        getYear(), getMonthOfYear(), getDayOfMonth(),
        time.getHourOfDay(), time.getMinuteOfHour(),
        time.getSecondOfMinute(), time.getMillisOfSecond(), chrono);

代码示例来源:origin: JodaOrg/joda-time

return new DateTime(
        getYear(), getMonthOfYear(), getDayOfMonth(),
        time.getHourOfDay(), time.getMinuteOfHour(),
        time.getSecondOfMinute(), time.getMillisOfSecond(), chrono);

代码示例来源:origin: apache/drill

int t = ((TimeExpression)valueArg).getTime();
LocalTime lT = LocalTime.fromMillisOfDay(t);
this.value = KeyValueBuilder.initFrom(new OTime(lT.getHourOfDay(), lT.getMinuteOfHour(), lT.getSecondOfMinute(), lT.getMillisOfSecond()));
this.path = path;
return true;

代码示例来源:origin: qcadoo/mes

private boolean checkIfEndDateShiftIsLaterThanDate(final LocalTime[] dayHour, final Date date) {
  Calendar cal = Calendar.getInstance();
  cal.setTime(date);
  int hourOfDay = cal.get(Calendar.HOUR_OF_DAY);
  int minuteOfHour = cal.get(Calendar.MINUTE);
  return hourOfDay < dayHour[1].getHourOfDay()
      || (hourOfDay == dayHour[1].getHourOfDay() && minuteOfHour < dayHour[1].getMinuteOfHour());
}

代码示例来源:origin: qcadoo/mes

private boolean checkIfStartDateShiftIsEarlierThanDate(final LocalTime[] dayHour, final Date date) {
  Calendar cal = Calendar.getInstance();
  cal.setTime(date);
  int hourOfDay = cal.get(Calendar.HOUR_OF_DAY);
  int minuteOfHour = cal.get(Calendar.MINUTE);
  return dayHour[0].getHourOfDay() < hourOfDay
      || (dayHour[0].getHourOfDay() == hourOfDay && dayHour[0].getMinuteOfHour() <= minuteOfHour);
}

代码示例来源:origin: stackoverflow.com

LocalTime timeInAM=new LocalTime(hourOfDay, minuteOfHour);
LocalTime timeOutAM=new LocalTime(hourOfDay, minuteOfHour);
LocalTime timeInPM=new LocalTime(hourOfDay, minuteOfHour);
LocalTime timeOutPM=new LocalTime(hourOfDay, minuteOfHour);

LocalTime amInterval = timeOutAM.minusHours(timeInAM.getHourOfDay()).minusMinutes(timeInAM.getMinuteOfHour());
LocalTime pmInterval = timeOutPM.minusHours(timeInPM.getHourOfDay()).minusMinutes(timeInPM.getMinuteOfHour());

LocalTime total = pmInterval.plusHours(amInterval.getHourOfDay()).plusMinutes(amInterval.getMinuteOfHour());

代码示例来源:origin: qcadoo/mes

private boolean isChangeOverOnThisPrint(final Entity order, final Entity report, final LocalTime startTime) {
  Date startOrderDate = order.getDateField(OrderFields.START_DATE);
  Date reportFromDate = report.getDateField(PPSReportFields.DATE_FROM);
  DateTime date = new DateTime(reportFromDate).withHourOfDay(startTime.getHourOfDay());
  return startOrderDate.after(date.toDate());
}

代码示例来源:origin: Jasig/uPortal

TimeDimensionImpl(LocalTime time) {
  this.id = -1;
  this.time = time.minuteOfHour().roundFloorCopy(); // truncate at minute level
  this.hour = this.time.getHourOfDay();
  this.minute = this.time.getMinuteOfHour();
  this.fiveMinuteIncrement = this.minute / 5;
}

代码示例来源:origin: bingoohuang/eql

@Override public Object map(Object obj) {
    val t = (LocalTime) obj;
    return Time.valueOf(java.time.LocalTime.of(t.getHourOfDay(), t.getMinuteOfHour(), t.getSecondOfMinute(), t.getMillisOfSecond()));
  }
}

代码示例来源:origin: qcadoo/mes

private Optional<DateTime> getShiftEndDate(DateTime day, Entity shift) {
  Shift shiftFirst = new Shift(shift);
  List<TimeRange> ranges = shiftFirst.findWorkTimeAt(day.toLocalDate());
  if (ranges.isEmpty()) {
    return Optional.empty();
  }
  LocalTime startTime = ranges.get(0).getTo();
  DateTime startShitTime = day;
  startShitTime = startShitTime.withHourOfDay(startTime.getHourOfDay());
  startShitTime = startShitTime.withMinuteOfHour(startTime.getMinuteOfHour());
  return Optional.of(startShitTime);
}

代码示例来源:origin: qcadoo/mes

private Optional<DateTime> getShiftStartDate(DateTime day, Entity shift) {
  Shift shiftFirst = new Shift(shift);
  List<TimeRange> ranges = shiftFirst.findWorkTimeAt(day.toLocalDate());
  if (ranges.isEmpty()) {
    return Optional.empty();
  }
  LocalTime startTime = ranges.get(0).getFrom();
  DateTime startShitTime = day;
  startShitTime = startShitTime.withHourOfDay(startTime.getHourOfDay());
  startShitTime = startShitTime.withMinuteOfHour(startTime.getMinuteOfHour());
  return Optional.of(startShitTime);
}

代码示例来源:origin: org.jadira.usertype/usertype.core

@Override
public TimeOfDay fromNonNullValue(Time value) {
  DateTime dateTime = new DateTime(value.getTime());
  LocalTime localTime = dateTime.toLocalTime();
  final TimeOfDay timeOfDay = new TimeOfDay(localTime.getHourOfDay(), localTime.getMinuteOfHour(), localTime.getSecondOfMinute(), localTime.getMillisOfSecond(), localTime.getChronology());
  return timeOfDay;
}

代码示例来源:origin: org.jadira.usertype/usertype.jodatime

@Override
public TimeOfDay fromNonNullValue(Timestamp value) {
  final LocalTime localTime = Formatter.LOCAL_DATETIME_PARSER.parseDateTime(value.toString()).toLocalTime();
  final TimeOfDay timeOfDay = new TimeOfDay(localTime.getHourOfDay(), localTime.getMinuteOfHour(), localTime.getSecondOfMinute(), localTime.getMillisOfSecond(), localTime.getChronology());
  return timeOfDay;
}

代码示例来源:origin: org.jadira.usertype/usertype.core

@Override
public TimeOfDay fromNonNullValue(Timestamp value) {
  DateTime dateTime = new DateTime(value.getTime());
  LocalTime localTime = dateTime.toLocalTime();
  final TimeOfDay timeOfDay = new TimeOfDay(localTime.getHourOfDay(), localTime.getMinuteOfHour(), localTime.getSecondOfMinute(), localTime.getMillisOfSecond(), localTime.getChronology());
  return timeOfDay;
}

代码示例来源:origin: org.jadira.usertype/usertype.core

@Override
  public Timestamp toNonNullValue(LocalTime value) {

    DateTime zonedValue = new LocalDateTime(
        1970,1,1,value.getHourOfDay(), value.getMinuteOfHour(), value.getSecondOfMinute(), value.getMillisOfSecond(), value.getChronology()
    ).toDateTime();

    final Timestamp timestamp = new Timestamp(zonedValue.getMillis());
    return timestamp;
  }
}

代码示例来源:origin: org.jadira.usertype/usertype.core

@Override
  public Time toNonNullValue(LocalTime value) {

    DateTime zonedValue = new LocalDateTime(
        1970,1,1,value.getHourOfDay(), value.getMinuteOfHour(), value.getSecondOfMinute(), value.getMillisOfSecond(), value.getChronology()
    ).toDateTime();

    final Time time = new Time(zonedValue.getMillis());
    return time;
  }
}

代码示例来源:origin: arnaudroger/SimpleFlatMapper

@Override
  public java.time.LocalTime convert(LocalTime in, Context context) throws Exception {
    if (in == null) return null;
    return java.time.LocalTime.of(in.getHourOfDay(), in.getMinuteOfHour(), in.getSecondOfMinute(), in.getMillisOfSecond() * 1000);
  }
}

代码示例来源:origin: org.jasig.portlet/blackboardvc-portlet-api

@Future
@FutureWithYearLimit()
public DateTime getStartTime() {
  return startDate.toDateTime().withHourOfDay(startHourMinute.getHourOfDay()).withMinuteOfHour(startHourMinute.getMinuteOfHour());
}

相关文章