compareTo 方法 (DateTimeOffset)
将此 DateTimeOffset 对象与另一个基于 GMT 时间的 DateTimeOffset 对象进行比较。
语法
public int compareTo(DateTimeOffset other)
参数
要与当前实例进行比较的 DateTimeOffset 值。
返回值
下表介绍了此方法的返回值:
返回值 | 说明 |
---|---|
0 | 两个 DateTimeOffset 对象都表示相同的时间点。 |
负数 | 此 DateTimeOffset 对象表示在 other 之前的时间点。 |
正数 | 此 DateTimeOffset 对象表示在 other 之后的时间点。 |
注解
当两个 DateTimeOffset 对象具有相同的 GMT 时间时,没有基于偏移量的对象的附加排序。
另请参阅
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈