-
public final class DateTime
-
-
Method Summary
Modifier and Type Method Description final static Stringformat(Date $self, DateFormatPattern pattern)使用指定的日期格式模式将 Date 对象格式化为字符串。 final static Stringformat(Long $self, DateFormatPattern pattern)使用指定的日期格式模式将时间戳(Long 类型)格式化为字符串。 final static Stringformat(String $self, DateFormatPattern currentPattern, DateFormatPattern nextPattern)将字符串表示的日期按当前模式解析,并使用新模式格式化。 final static Datedate(String $self, DateFormatPattern pattern)尝试使用指定的日期格式模式解析字符串为 Date 对象。 final static BooleanwithinToday(Date $self)检查 Date 对象是否表示今天的日期。 final static BooleanwithinToday(Long $self)检查 Long 类型的时间戳是否表示今天的日期。 final static Booleanwithin7Days(Date $self)检查 Date 对象是否在未来7天内。 final static Booleanwithin7Days(Long $self)检查 Long 类型的时间戳是否表示未来7天内的日期。 final static Booleanwithin3Days(Date $self)检查 Date 对象是否在未来3天内。 final static BooleanisExpired(Long $self)检查 Long 类型的时间戳表示的日期是否已过期,即是否在当前日期之前。 final static Dateafter(Date $self, Integer days)获取 Date 对象在指定天数后的日期。 -
-
Method Detail
-
format
final static String format(Date $self, DateFormatPattern pattern)
使用指定的日期格式模式将 Date 对象格式化为字符串。
- Parameters:
pattern- 用于格式化的日期格式模式。
-
format
final static String format(Long $self, DateFormatPattern pattern)
使用指定的日期格式模式将时间戳(Long 类型)格式化为字符串。
- Parameters:
pattern- 用于格式化的日期格式模式。
-
format
final static String format(String $self, DateFormatPattern currentPattern, DateFormatPattern nextPattern)
将字符串表示的日期按当前模式解析,并使用新模式格式化。
- Parameters:
currentPattern- 当前日期字符串的格式模式。nextPattern- 要格式化到的日期格式模式。
-
date
final static Date date(String $self, DateFormatPattern pattern)
尝试使用指定的日期格式模式解析字符串为 Date 对象。
- Parameters:
pattern- 用于解析的日期格式模式。
-
withinToday
final static Boolean withinToday(Date $self)
检查 Date 对象是否表示今天的日期。
-
withinToday
final static Boolean withinToday(Long $self)
检查 Long 类型的时间戳是否表示今天的日期。
-
within7Days
final static Boolean within7Days(Date $self)
检查 Date 对象是否在未来7天内。
-
within7Days
final static Boolean within7Days(Long $self)
检查 Long 类型的时间戳是否表示未来7天内的日期。
-
within3Days
final static Boolean within3Days(Date $self)
检查 Date 对象是否在未来3天内。
-
-
-
-