1 | <?php |
||
8 | trait DateTimeHelper |
||
9 | { |
||
10 | /** |
||
11 | * Create DateTime object from time string and timezone. |
||
12 | * |
||
13 | * @param string|null $time Time string, default to 'now' |
||
14 | * @param string|null $tz Timezone, default if omitted |
||
15 | * @throws \RuntimeException |
||
16 | * @return \DateTimeImmutable |
||
17 | */ |
||
18 | private static function _createDateTime($time = null, $tz = null): \DateTimeImmutable |
||
33 | |||
34 | /** |
||
35 | * Rounds a \DateTimeImmutable value such that fractional |
||
36 | * seconds are removed. |
||
37 | * |
||
38 | * @param \DateTimeImmutable $dt |
||
39 | * @return \DateTimeImmutable |
||
40 | */ |
||
41 | private static function _roundDownFractionalSeconds(\DateTimeImmutable $dt): \DateTimeImmutable |
||
46 | |||
47 | /** |
||
48 | * Create DateTimeZone object from string. |
||
49 | * |
||
50 | * @param string $tz |
||
51 | * @throws \UnexpectedValueException |
||
52 | * @return \DateTimeZone |
||
53 | */ |
||
54 | private static function _createTimeZone($tz) |
||
62 | |||
63 | /** |
||
64 | * Get last error caused by DateTimeImmutable. |
||
65 | * |
||
66 | * @return string |
||
67 | */ |
||
68 | private static function _getLastDateTimeImmutableErrorsStr() |
||
73 | } |
||
74 |