1 | <?php |
||
18 | class Dater |
||
19 | { |
||
20 | /** |
||
21 | * time zone |
||
22 | * |
||
23 | * @var DateTimeZone |
||
24 | */ |
||
25 | |||
26 | protected $_timeZone; |
||
27 | |||
28 | /** |
||
29 | * date time |
||
30 | * |
||
31 | * @var DateTime |
||
32 | */ |
||
33 | |||
34 | protected $_dateTime; |
||
35 | |||
36 | /** |
||
37 | * init the class |
||
38 | * |
||
39 | * @since 4.0.0 |
||
40 | * |
||
41 | * @param int $date timestamp of the date |
||
42 | */ |
||
43 | |||
44 | 2 | public function init(int $date = null) : void |
|
60 | |||
61 | /** |
||
62 | * get the time zone |
||
63 | * |
||
64 | * @since 4.0.0 |
||
65 | * |
||
66 | * @return DateTimeZone |
||
67 | */ |
||
68 | |||
69 | 1 | public function getTimeZone() : DateTimeZone |
|
73 | |||
74 | /** |
||
75 | * get the date time |
||
76 | * |
||
77 | * @since 4.0.0 |
||
78 | * |
||
79 | * @return DateTime |
||
80 | */ |
||
81 | |||
82 | 2 | public function getDateTime() : DateTime |
|
86 | |||
87 | /** |
||
88 | * format to time |
||
89 | * |
||
90 | * @since 4.0.0 |
||
91 | * |
||
92 | * @return string |
||
93 | */ |
||
94 | |||
95 | 1 | public function formatTime() : string |
|
100 | |||
101 | /** |
||
102 | * format to date |
||
103 | * |
||
104 | * @since 4.0.0 |
||
105 | * |
||
106 | * @return string |
||
107 | */ |
||
108 | |||
109 | 1 | public function formatDate() : string |
|
114 | |||
115 | /** |
||
116 | * format to field |
||
117 | * |
||
118 | * @since 4.0.0 |
||
119 | * |
||
120 | * @return string |
||
121 | */ |
||
122 | |||
123 | 1 | public function formatField() : string |
|
127 | } |
||
128 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
integer
values, zero is a special case, in particular the following results might be unexpected: