1 | <?php |
||
7 | abstract class DateTime |
||
8 | { |
||
9 | /** |
||
10 | * Returns true if the given date time is a Saturday or Sunday. |
||
11 | * |
||
12 | * @param \DateTime $dateTime The date/time object. |
||
13 | * |
||
14 | * @return boolean |
||
15 | */ |
||
16 | final public static function isWeekendDay(\DateTime $dateTime) |
||
21 | |||
22 | /** |
||
23 | * Returns true if the given date time is not a Saturday or Sunday. |
||
24 | * |
||
25 | * @param \DateTime $dateTime The date/time object. |
||
26 | * |
||
27 | * @return boolean |
||
28 | */ |
||
29 | final public static function isWeekDay(\DateTime $dateTime) |
||
34 | |||
35 | /** |
||
36 | * Returns true if the given dates occur on the same year, month and day. |
||
37 | * |
||
38 | * @param \DateTime $thisDate A date to compare. |
||
39 | * @param \DateTime $thatDate A date to compare. |
||
40 | * |
||
41 | * @return boolean |
||
42 | */ |
||
43 | final public static function isSameDay(\DateTime $thisDate, \DateTime $thatDate) |
||
48 | |||
49 | /** |
||
50 | * Indicates whether the given instance of DateTime is within the daylight saving time range for the current time |
||
51 | * zone. |
||
52 | * |
||
53 | * @param \DateTime $dateTime The date/time object. |
||
54 | * |
||
55 | * @return boolean |
||
56 | */ |
||
57 | final public static function isDaylightSavings(\DateTime $dateTime) |
||
61 | |||
62 | /** |
||
63 | * Returns true if the given date is between the provided date range. |
||
64 | * |
||
65 | * @param \DateTime $subjectDate The date/time object being checked. |
||
66 | * @param \DateTime $startDate The start date/time object. |
||
67 | * @param \DateTime $endDate The end date/time object. |
||
68 | * |
||
69 | * @return boolean |
||
70 | * @throws \DomainException Thrown when an invalid date range is provided. |
||
71 | */ |
||
72 | final public static function isInRange(\DateTime $subjectDate, \DateTime $startDate, \DateTime $endDate) |
||
82 | |||
83 | /** |
||
84 | * Returns the given DateTime instance as a "time ago" string. |
||
85 | * |
||
86 | * @param \DateTime $dateTime The DateTime object to present as an ago string. |
||
87 | * |
||
88 | * @return string |
||
89 | * |
||
90 | * @throws \DomainException Thrown if the given $dateTime is in the future. |
||
91 | */ |
||
92 | final public static function asAgoString(\DateTime $dateTime) |
||
121 | } |
||
122 |