org.threeten.bp.LocalDateTime.compareTo()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(142)

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

LocalDateTime.compareTo介绍

[英]Compares this date-time to another date-time.

The comparison is primarily based on the date-time, from earliest to latest. It is "consistent with equals", as defined by Comparable.

If all the date-times being compared are instances of LocalDateTime, then the comparison will be entirely based on the date-time. If some dates being compared are in different chronologies, then the chronology is also considered, see ChronoLocalDateTime#compareTo.
[中]将此日期时间与另一个日期时间进行比较。
比较主要基于日期时间,从最早到最晚。它是“与相等一致的”,如Comparable所定义。
如果所有被比较的日期时间都是LocalDateTime的实例,那么比较将完全基于日期时间。如果正在比较的某些日期采用不同的年表,则也会考虑该年表,请参见ChronoLocalDateTime#compareTo。

代码示例

代码示例来源:origin: net.oneandone.ical4j/ical4j

@Override
  public int compare(ZoneOffsetTransition z1, ZoneOffsetTransition z2) {
    return z1.getDateTimeBefore().compareTo(z2.getDateTimeBefore());
  }
});

代码示例来源:origin: ThreeTen/threetenbp

public int compareTo(OffsetDateTime other) {
  if (getOffset().equals(other.getOffset())) {
    return toLocalDateTime().compareTo(other.toLocalDateTime());
    cmp = toLocalTime().getNano() - other.toLocalTime().getNano();
    if (cmp == 0) {
      cmp = toLocalDateTime().compareTo(other.toLocalDateTime());

代码示例来源:origin: org.threeten/threetenbp

public int compareTo(OffsetDateTime other) {
  if (getOffset().equals(other.getOffset())) {
    return toLocalDateTime().compareTo(other.toLocalDateTime());
    cmp = toLocalTime().getNano() - other.toLocalTime().getNano();
    if (cmp == 0) {
      cmp = toLocalDateTime().compareTo(other.toLocalDateTime());

相关文章