1 | <?php |
||
29 | class DateTime |
||
30 | { |
||
31 | /** |
||
32 | * The 'c' format, expanded in separate format characters. This string can also be used with |
||
33 | * `DateTime::createFromString()`. |
||
34 | */ |
||
35 | const FORMAT = 'Y-m-d\\TH:i:sP'; |
||
36 | |||
37 | /** |
||
38 | * Allows for mocking of time. |
||
39 | * |
||
40 | * @var self|null |
||
41 | */ |
||
42 | private static $now; |
||
43 | |||
44 | /** |
||
45 | * @var CoreDateTime |
||
46 | */ |
||
47 | private $dateTime; |
||
48 | |||
49 | /** |
||
50 | * @return self |
||
51 | */ |
||
52 | public static function now() |
||
56 | |||
57 | /** |
||
58 | * @param string $string A date-time string formatted using `self::FORMAT` (eg. '2014-11-26T15:20:43+01:00'). |
||
59 | * @return self |
||
60 | */ |
||
61 | public static function fromString($string) |
||
75 | |||
76 | /** |
||
77 | * @param CoreDateTime|null $dateTime |
||
78 | */ |
||
79 | public function __construct(CoreDateTime $dateTime = null) |
||
83 | |||
84 | /** |
||
85 | * @param DateInterval $interval |
||
86 | * @return DateTime |
||
87 | */ |
||
88 | public function add(DateInterval $interval) |
||
95 | |||
96 | /** |
||
97 | * @param DateInterval $interval |
||
98 | * @return DateTime |
||
99 | */ |
||
100 | public function sub(DateInterval $interval) |
||
107 | |||
108 | /** |
||
109 | * @return DateTime |
||
110 | */ |
||
111 | public function endOfDay() |
||
118 | |||
119 | /** |
||
120 | * @param DateTime $dateTime |
||
121 | * @return boolean |
||
122 | */ |
||
123 | public function comesBefore(DateTime $dateTime) |
||
127 | |||
128 | /** |
||
129 | * @param DateTime $dateTime |
||
130 | * @return boolean |
||
131 | */ |
||
132 | public function comesBeforeOrIsEqual(DateTime $dateTime) |
||
136 | |||
137 | /** |
||
138 | * @param DateTime $dateTime |
||
139 | * @return boolean |
||
140 | */ |
||
141 | public function comesAfter(DateTime $dateTime) |
||
145 | |||
146 | /** |
||
147 | * @param DateTime $dateTime |
||
148 | * @return boolean |
||
149 | */ |
||
150 | public function comesAfterOrIsEqual(DateTime $dateTime) |
||
154 | |||
155 | /** |
||
156 | * @param $format |
||
157 | * @return string |
||
158 | */ |
||
159 | public function format($format) |
||
172 | |||
173 | /** |
||
174 | * @return string An ISO 8601 representation of this DateTime. |
||
175 | */ |
||
176 | public function __toString() |
||
180 | } |
||
181 |