Conditions | 1 |
Paths | 1 |
Total Lines | 11 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php declare(strict_types = 1); |
||
15 | public function transform(float|int $value): DateTimeImmutable |
||
16 | { |
||
17 | $format = 'd-m-Y H:i:s'; |
||
18 | $base = 25569; |
||
19 | |||
20 | $value = (int) floor(num: $value); |
||
21 | /** @noinspection SummerTimeUnsafeTimeManipulationInspection */ |
||
22 | $unix = ($value - $base) * 86400; |
||
23 | $date = gmdate(format: $format, timestamp: $unix); |
||
24 | |||
25 | return DateTimeImmutable::createFromFormat(format: '!' . $format, datetime: $date); |
||
26 | } |
||
28 |