4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Intl\DateFormatter\DateFormat
;
15 * Parser and formatter for 24 hour format (1-24)
17 * @author Igor Wiedler <igor@wiedler.ch>
19 class Hour2401Transformer
extends HourTransformer
24 public function format(\DateTime
$dateTime, $length)
26 $hourOfDay = $dateTime->format('G');
27 $hourOfDay = ('0' == $hourOfDay) ? '24' : $hourOfDay;
29 return $this->padLeft($hourOfDay, $length);
35 public function normalizeHour($hour, $marker = null)
37 if ((null === $marker && 24 === $hour) || 'AM' == $marker) {
39 } elseif ('PM' == $marker) {
49 public function getReverseMatchingRegExp($length)
57 public function extractDateOptions($matched, $length)
60 'hour' => (int) $matched,
61 'hourInstance' => $this