@@ 156-165 (lines=10) @@ | ||
153 | * |
|
154 | * @return string Returns an empty string if $value is empty, the localized textual representation otherwise |
|
155 | */ |
|
156 | public static function formatDate($value, $width = 'short', $toTimezone = '', $locale = '') |
|
157 | { |
|
158 | try { |
|
159 | $formatted = Calendar::formatDateEx($value, $width, $toTimezone, $locale); |
|
160 | } catch (\Punic\Exception $e) { |
|
161 | \Xoops::getInstance()->events()->triggerEvent('core.exception', $e); |
|
162 | $formatted = ''; |
|
163 | } |
|
164 | return $formatted; |
|
165 | } |
|
166 | ||
167 | /** |
|
168 | * Format a date. |
|
@@ 185-194 (lines=10) @@ | ||
182 | * |
|
183 | * @throws \Punic\Exception Throws an exception in case of problems |
|
184 | */ |
|
185 | public static function formatTime($value, $width = 'short', $toTimezone = '', $locale = '') |
|
186 | { |
|
187 | try { |
|
188 | $formatted = Calendar::formatTimeEx($value, $width, $toTimezone, $locale); |
|
189 | } catch (\Punic\Exception $e) { |
|
190 | \Xoops::getInstance()->events()->triggerEvent('core.exception', $e); |
|
191 | $formatted = ''; |
|
192 | } |
|
193 | return $formatted; |
|
194 | } |
|
195 | ||
196 | /** |
|
197 | * Format a date/time. |