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

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

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

LocalDateTime.toLocalDate介绍

[英]Converts this object to a LocalDate with the same date and chronology.
[中]将此对象转换为具有相同日期和时间顺序的LocalDate。

代码示例

代码示例来源:origin: spring-projects/spring-framework

@Override
  public LocalDate convert(LocalDateTime source) {
    return source.toLocalDate();
  }
}

代码示例来源:origin: org.springframework/spring-context

@Override
  public LocalDate convert(LocalDateTime source) {
    return source.toLocalDate();
  }
}

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

/**
 * Parses only the local date from the given text, returning a new LocalDate.
 * <p>
 * This will parse the text fully according to the formatter, using the UTC zone.
 * Once parsed, only the local date will be used.
 * This means that any parsed time, time-zone or offset field is completely ignored.
 * It also means that the zone and offset-parsed settings are ignored.
 *
 * @param text  the text to parse, not null
 * @return the parsed date, never null
 * @throws UnsupportedOperationException if parsing is not supported
 * @throws IllegalArgumentException if the text to parse is invalid
 * @since 2.0
 */
public LocalDate parseLocalDate(String text) {
  return parseLocalDateTime(text).toLocalDate();
}

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

/**
 * Parses only the local date from the given text, returning a new LocalDate.
 * <p>
 * This will parse the text fully according to the formatter, using the UTC zone.
 * Once parsed, only the local date will be used.
 * This means that any parsed time, time-zone or offset field is completely ignored.
 * It also means that the zone and offset-parsed settings are ignored.
 *
 * @param text  the text to parse, not null
 * @return the parsed date, never null
 * @throws UnsupportedOperationException if parsing is not supported
 * @throws IllegalArgumentException if the text to parse is invalid
 * @since 2.0
 */
public LocalDate parseLocalDate(String text) {
  return parseLocalDateTime(text).toLocalDate();
}

代码示例来源:origin: alibaba/fastjson

if (text.length() == 23) {
  LocalDateTime localDateTime = LocalDateTime.parse(text);
  localDate = localDateTime.toLocalDate();
} else {
  localDate = parseLocalDate(text, format, formatter);
return (T) localDateTime.toLocalDate();

代码示例来源:origin: com.alibaba/fastjson

if (text.length() == 23) {
  LocalDateTime localDateTime = LocalDateTime.parse(text);
  localDate = localDateTime.toLocalDate();
} else {
  localDate = parseLocalDate(text, format, formatter);
return (T) localDateTime.toLocalDate();

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Parses only the local date from the given text, returning a new LocalDate.
 * <p>
 * This will parse the text fully according to the formatter, using the UTC zone.
 * Once parsed, only the local date will be used.
 * This means that any parsed time, time-zone or offset field is completely ignored.
 * It also means that the zone and offset-parsed settings are ignored.
 *
 * @param text  the text to parse, not null
 * @return the parsed date, never null
 * @throws UnsupportedOperationException if parsing is not supported
 * @throws IllegalArgumentException if the text to parse is invalid
 * @since 2.0
 */
public LocalDate parseLocalDate(String text) {
  return parseLocalDateTime(text).toLocalDate();
}

代码示例来源:origin: apache/servicemix-bundles

@Override
  public LocalDate convert(LocalDateTime source) {
    return source.toLocalDate();
  }
}

代码示例来源:origin: com.synaptix/SynaptixWidget

@Override
  public Object parseObject(String source) throws ParseException {
    if ((source.length() >= 1) && ((source.charAt(0) == '+') || ((source.charAt(0) == '-')))) {
      return transformText(source, pattern).toLocalDate();
    }
    if (StringUtils.isBlank(source)) {
      return null;
    }
    return super.parseObject(source);
  }
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

/**
 * Parses only the local date from the given text, returning a new LocalDate.
 * <p>
 * This will parse the text fully according to the formatter, using the UTC zone.
 * Once parsed, only the local date will be used.
 * This means that any parsed time, time-zone or offset field is completely ignored.
 * It also means that the zone and offset-parsed settings are ignored.
 *
 * @param text  the text to parse, not null
 * @return the parsed date, never null
 * @throws UnsupportedOperationException if parsing is not supported
 * @throws IllegalArgumentException if the text to parse is invalid
 * @since 2.0
 */
public LocalDate parseLocalDate(String text) {
  return parseLocalDateTime(text).toLocalDate();
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

/**
 * Parses only the local date from the given text, returning a new LocalDate.
 * <p>
 * This will parse the text fully according to the formatter, using the UTC zone.
 * Once parsed, only the local date will be used.
 * This means that any parsed time, time-zone or offset field is completely ignored.
 * It also means that the zone and offset-parsed settings are ignored.
 *
 * @param text  the text to parse, not null
 * @return the parsed date, never null
 * @throws UnsupportedOperationException if parsing is not supported
 * @throws IllegalArgumentException if the text to parse is invalid
 * @since 2.0
 */
public LocalDate parseLocalDate(String text) {
  return parseLocalDateTime(text).toLocalDate();
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.joda-time

/**
 * Parses only the local date from the given text, returning a new LocalDate.
 * <p>
 * This will parse the text fully according to the formatter, using the UTC zone.
 * Once parsed, only the local date will be used.
 * This means that any parsed time, time-zone or offset field is completely ignored.
 * It also means that the zone and offset-parsed settings are ignored.
 *
 * @param text  the text to parse, not null
 * @return the parsed date, never null
 * @throws UnsupportedOperationException if parsing is not supported
 * @throws IllegalArgumentException if the text to parse is invalid
 * @since 2.0
 */
public LocalDate parseLocalDate(String text) {
  return parseLocalDateTime(text).toLocalDate();
}

代码示例来源:origin: Nextdoor/bender

/**
 * Parses only the local date from the given text, returning a new LocalDate.
 * <p>
 * This will parse the text fully according to the formatter, using the UTC zone.
 * Once parsed, only the local date will be used.
 * This means that any parsed time, time-zone or offset field is completely ignored.
 * It also means that the zone and offset-parsed settings are ignored.
 *
 * @param text  the text to parse, not null
 * @return the parsed date, never null
 * @throws UnsupportedOperationException if parsing is not supported
 * @throws IllegalArgumentException if the text to parse is invalid
 * @since 2.0
 */
public LocalDate parseLocalDate(String text) {
  return parseLocalDateTime(text).toLocalDate();
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

/**
 * Parses only the local date from the given text, returning a new LocalDate.
 * <p>
 * This will parse the text fully according to the formatter, using the UTC zone.
 * Once parsed, only the local date will be used.
 * This means that any parsed time, time-zone or offset field is completely ignored.
 * It also means that the zone and offset-parsed settings are ignored.
 *
 * @param text  the text to parse, not null
 * @return the parsed date, never null
 * @throws UnsupportedOperationException if parsing is not supported
 * @throws IllegalArgumentException if the text to parse is invalid
 * @since 2.0
 */
public LocalDate parseLocalDate(String text) {
  return parseLocalDateTime(text).toLocalDate();
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics

/**
 * Parses only the local date from the given text, returning a new LocalDate.
 * <p>
 * This will parse the text fully according to the formatter, using the UTC zone.
 * Once parsed, only the local date will be used.
 * This means that any parsed time, time-zone or offset field is completely ignored.
 * It also means that the zone and offset-parsed settings are ignored.
 *
 * @param text  the text to parse, not null
 * @return the parsed date, never null
 * @throws UnsupportedOperationException if parsing is not supported
 * @throws IllegalArgumentException if the text to parse is invalid
 * @since 2.0
 */
public LocalDate parseLocalDate(String text) {
  return parseLocalDateTime(text).toLocalDate();
}

代码示例来源:origin: redfish64/TinyTravelTracker

/**
 * Parses only the local date from the given text, returning a new LocalDate.
 * <p>
 * This will parse the text fully according to the formatter, using the UTC zone.
 * Once parsed, only the local date will be used.
 * This means that any parsed time, time-zone or offset field is completely ignored.
 * It also means that the zone and offset-parsed settings are ignored.
 *
 * @param text  the text to parse, not null
 * @return the parsed date, never null
 * @throws UnsupportedOperationException if parsing is not supported
 * @throws IllegalArgumentException if the text to parse is invalid
 * @since 2.0
 */
public LocalDate parseLocalDate(String text) {
  return parseLocalDateTime(text).toLocalDate();
}

代码示例来源:origin: tcplugins/tcWebHooks

private Map<LocalDate, List<WebHookHistoryItem>> findHistoryItemsGroupedByDay(LocalDate untilDate, int numberOfDays, List<WebHookHistoryItem> items) {
  Map<LocalDate, List<WebHookHistoryItem>> groupedHistoryItems = new LinkedHashMap<>(numberOfDays);
  for (LocalDate thisDate : getArrayOfDates(untilDate, numberOfDays)) {
    List<WebHookHistoryItem> thisDateList = new ArrayList<>();
    for (WebHookHistoryItem item : items) {
      if (thisDate.isEqual(item.getTimestamp().toLocalDate())) {
        thisDateList.add(item);
      }
    }
    groupedHistoryItems.put(thisDate, thisDateList);
  }
  return groupedHistoryItems;
}

代码示例来源:origin: tcplugins/tcWebHooks

private List<WebHookHistoryItem> findAllItemsSince(LocalDate untilDate, int numberOfDays) {
  List<WebHookHistoryItem> erroredItemsSince = new ArrayList<>();
  LocalDate sinceDate = untilDate.minusDays(numberOfDays);
  for (WebHookHistoryItem item : this.webHookHistoryItems.values()) {
    LocalDate itemTimeStamp = item.getTimestamp().toLocalDate(); 
    if (sinceDate.isBefore(itemTimeStamp) && untilDate.isAfter(itemTimeStamp)) {
      erroredItemsSince.add(item);
    }
  }
  return erroredItemsSince;
}

代码示例来源:origin: tcplugins/tcWebHooks

private List<WebHookHistoryItem> findItemsSince(LocalDate untilDate, int numberOfDays, boolean isErrored, boolean isDisabled) {
  List<WebHookHistoryItem> itemsSince = new ArrayList<>();
  LocalDate sinceDate = untilDate.minusDays(numberOfDays);
  for (WebHookHistoryItem item : this.webHookHistoryItems.values()) {
    LocalDate itemTimeStamp = item.getTimestamp().toLocalDate(); 
    if (sinceDate.isBefore(itemTimeStamp) 
        && untilDate.isAfter(itemTimeStamp) 
        && item.getWebHookExecutionStats().isErrored() == isErrored 
        && item.getWebHookExecutionStats().isEnabled() != isDisabled) {
      itemsSince.add(item);
    }
  }
  return itemsSince;
}

代码示例来源:origin: org.kuali.kpme/kpme-tk-lm-impl

private void setBlockSubmittable(LeaveCalendarForm leaveForm, LeaveCalendarDocument lcd) {
  
  leaveForm.setBlockSubmittable(false); 
  
  if(leaveForm != null) {
    // Do NOT use leaveForm.getStartDate - We don't know why it's there
    if (leaveForm.getCalendarEntry().getBeginPeriodFullDateTime() != null && StringUtils.isBlank(leaveForm.getDocumentId())) {
      if (LocalDate.now().isBefore(leaveForm.getCalendarEntry().getBeginPeriodLocalDateTime().toLocalDate())) {
        leaveForm.setBlockSubmittable(true);
      }
    }             
  }
}

相关文章