是否有任何标准 Java 实现来表示FROM和TO的时间范围?实际上我正在使用以下课程。
我还查看了Instant.range()或Period,它们都没有定义时间范围或跨度,而是计算一个时间段的持续时间,而不是使用FROM和TO保存确切的时间范围。
public class TimeRange {
private Instant from, to;
public TimeRange(Instant from, Instant to) {
this.from = from;
this.to = to;
}
public Instant getFrom() {
return from;
}
public void setFrom(Instant from) {
this.from = from;
}
public Instant getTo() {
return to;
}
public void setTo(Instant to) {
this.to = to;
}
public boolean isProperlySet() {
return from != null && to != null;
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6320 次 |
| 最近记录: |