目录

boolean isEqual(OffsetDateTime other)

描述 (Description)

java.time.OffsetDateTime.isEqual(OffsetDateTime other)方法检查此日期时间是否等于指定的日期时间。

声明 (Declaration)

以下是java.time.OffsetDateTime.isEqual(OffsetDateTime other)方法的声明。

public boolean isEqual(OffsetDateTime other)

参数 (Parameters)

other - 要比较的另一个日期,而不是null。

返回值 (Return Value)

如果此日期等于指定日期,则为true。

例子 (Example)

以下示例显示了java.time.OffsetDateTime.isEqual(OffsetDateTime other)方法的用法。

package com.iowiki;
import java.time.OffsetDateTime;
public class OffsetDateTimeDemo {
   public static void main(String[] args) {
      OffsetDateTime date = OffsetDateTime.parse("2017-02-03T12:30:30+01:00");
      OffsetDateTime date1 = OffsetDateTime.parse("2017-03-03T12:30:30+01:00");
      System.out.println(date1.isEqual(date));  
   }
}

让我们编译并运行上面的程序,这将产生以下结果 -

false
↑回到顶部↑
WIKI教程 @2018