1 | <?php |
||
28 | class DateTime |
||
29 | { |
||
30 | /** |
||
31 | * This string can also be used with `DateTime::createFromString()`. |
||
32 | */ |
||
33 | const FORMAT = DATE_ATOM; |
||
34 | |||
35 | /** |
||
36 | * Allows for mocking of time. |
||
37 | * |
||
38 | * @var self|null |
||
39 | */ |
||
40 | private static $now; |
||
41 | |||
42 | /** |
||
43 | * @var CoreDateTime |
||
44 | */ |
||
45 | private $dateTime; |
||
46 | |||
47 | /** |
||
48 | * @return self |
||
49 | */ |
||
50 | public static function now() |
||
54 | |||
55 | /** |
||
56 | * @param string $string A date-time string formatted using `self::FORMAT` (eg. '2014-11-26T15:20:43+01:00'). |
||
57 | * @return DateTime |
||
58 | */ |
||
59 | public static function fromString($string) |
||
73 | |||
74 | /** |
||
75 | * @param CoreDateTime|null $dateTime |
||
76 | */ |
||
77 | public function __construct(CoreDateTime $dateTime = null) |
||
81 | |||
82 | /** |
||
83 | * @param DateInterval $interval |
||
84 | * @return DateTime |
||
85 | */ |
||
86 | public function add(DateInterval $interval) |
||
93 | |||
94 | /** |
||
95 | * @param DateInterval $interval |
||
96 | * @return DateTime |
||
97 | */ |
||
98 | public function sub(DateInterval $interval) |
||
105 | |||
106 | /** |
||
107 | * @param DateTime $dateTime |
||
108 | * @return boolean |
||
109 | */ |
||
110 | public function comesBefore(DateTime $dateTime) |
||
114 | |||
115 | /** |
||
116 | * @param DateTime $dateTime |
||
117 | * @return boolean |
||
118 | */ |
||
119 | public function comesBeforeOrIsEqual(DateTime $dateTime) |
||
123 | |||
124 | /** |
||
125 | * @param DateTime $dateTime |
||
126 | * @return boolean |
||
127 | */ |
||
128 | public function comesAfter(DateTime $dateTime) |
||
132 | |||
133 | /** |
||
134 | * @param DateTime $dateTime |
||
135 | * @return boolean |
||
136 | */ |
||
137 | public function comesAfterOrIsEqual(DateTime $dateTime) |
||
141 | |||
142 | /** |
||
143 | * @param $format |
||
144 | * @return string |
||
145 | */ |
||
146 | public function format($format) |
||
161 | |||
162 | /** |
||
163 | * @return string An ISO 8601 representation of this DateTime. |
||
164 | */ |
||
165 | public function __toString() |
||
169 | } |
||
170 |