@@ -458,6 +458,17 @@ public final class Period implements Serializable {
return Duration.ofMillis((begin + offset * 1000) - System.currentTimeMillis());
}
+ /**
+ * 判断指定日期是否包含在当前时间周期内
+ *
+ * @param date 日期对象
+ * @return true/false
+ */
+ public boolean contains(Date date) {
+ return date != null && this.begin != null && this.end != null
+ && !this.begin.after(date) && !this.end.before(date);
+ }
+
/**
* 时间周期偏移
*