1 | <?php |
||
22 | class DateTimeHelper |
||
23 | { |
||
24 | private const INTERNAL_DATE_FORMAT = 'Y-m-d'; |
||
25 | |||
26 | /** |
||
27 | * @param \DateTimeZone|null $timeZone |
||
28 | * |
||
29 | * @return \DateTime |
||
30 | */ |
||
31 | public function getCurrentDatetime(?\DateTimeZone $timeZone = null): \DateTime |
||
35 | |||
36 | /** |
||
37 | * @param \DateTimeZone|null $timeZone |
||
38 | * |
||
39 | * @return \DateTimeImmutable |
||
40 | */ |
||
41 | public function getCurrentDatetimeImmutable(?\DateTimeZone $timeZone = null): \DateTimeImmutable |
||
45 | |||
46 | /** |
||
47 | * @param DateRange $dateRange |
||
48 | * |
||
49 | * @throws UnexpectedValueException |
||
50 | * |
||
51 | * @return \DateTimeInterface[] |
||
52 | */ |
||
53 | public function getDatesFromDateRangeAsArrayOfObjects(DateRange $dateRange): array |
||
71 | |||
72 | /** |
||
73 | * @param DateRange $dateRange |
||
74 | * |
||
75 | * @return string[] |
||
76 | */ |
||
77 | public function getDatesFromDateRangeAsArrayOfStrings(DateRange $dateRange): array |
||
88 | |||
89 | /** |
||
90 | * @param \DateTimeInterface $originalDate |
||
91 | * |
||
92 | * @throws UnexpectedValueException |
||
93 | * |
||
94 | * @return \DateTime |
||
95 | */ |
||
96 | private function cloneDateTime(\DateTimeInterface $originalDate): \DateTime |
||
106 | } |
||
107 |