@@ -34,8 +34,10 @@ discard block |
||
34 | 34 | { |
35 | 35 | $lfy = $x->format('Y') - 1; // last full year |
36 | 36 | |
37 | - foreach([4, -100, 400] as $f) // leap year factors |
|
37 | + foreach([4, -100, 400] as $f) { |
|
38 | + // leap year factors |
|
38 | 39 | $d += ($lfy / $f); |
40 | + } |
|
39 | 41 | |
40 | 42 | return (int)(($lfy * 365.25) + $d + $x->format('z')); // days since 1.1.1001 from last year (+|-) leap days + days in current year |
41 | 43 | } |
@@ -54,8 +56,7 @@ discard block |
||
54 | 56 | $date_diff[$previous_part] = $amount_of_days % $limit; |
55 | 57 | $previous_part = $part; |
56 | 58 | $amount_of_days = intval($amount_of_days / $limit); |
57 | - } |
|
58 | - else |
|
59 | + } else |
|
59 | 60 | { |
60 | 61 | $date_diff[$previous_part] = $amount_of_days; |
61 | 62 | break; |
@@ -10,8 +10,7 @@ |
||
10 | 10 | { |
11 | 11 | $date = new \DateTimeImmutable("$parm"); |
12 | 12 | return $date->format($format); |
13 | - } |
|
14 | - catch(\Exception $e) |
|
13 | + } catch(\Exception $e) |
|
15 | 14 | { |
16 | 15 | return null; |
17 | 16 | } |