ICanBoogie/CLDR v1.6.0
  • Namespace
  • Class

Namespaces

  • ICanBoogie
    • CLDR

Classes

  • Calendar
  • CalendarCollection
  • ContextTransforms
  • Currency
  • CurrencyCollection
  • CurrencyFormatter
  • DateFormatter
  • DateTimeFormatter
  • FileProvider
  • ListFormatter
  • Locale
  • LocaleCollection
  • LocalizedCurrency
  • LocalizedDateTime
  • LocalizedListFormatter
  • LocalizedLocale
  • LocalizedNumberFormatter
  • LocalizedObject
  • LocalizedObjectWithFormatter
  • LocalizedTerritory
  • NumberFormatter
  • NumberPattern
  • NumberPatternParser
  • Numbers
  • ProviderCollection
  • RedisProvider
  • Repository
  • RunTimeProvider
  • Supplemental
  • Territory
  • TerritoryCollection
  • TimeFormatter
  • WebProvider

Interfaces

  • Exception
  • Formatter
  • LocalizeAwareInterface
  • Provider

Traits

  • CodePropertyTrait
  • CollectionTrait
  • LocalePropertyTrait
  • ProviderStorageBinding
  • RepositoryPropertyTrait

Exceptions

  • ResourceNotFound
  • TerritoryNotDefined
 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 
<?php

/*
 * This file is part of the ICanBoogie package.
 *
 * (c) Olivier Laviale <olivier.laviale@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace ICanBoogie\CLDR;

/**
 * Time formatter.
 *
 * <pre>
 * <?php
 *
 * namespace ICanBoogie\CLDR;
 *
 * $datetime = '2013-11-05 21:22:23';
 *
 * $formatter = new TimeFormatter($repository->locales['en']);
 *
 * echo $formatter($datetime, 'full');   // 9:22:23 PM CET
 * echo $formatter($datetime, 'long');   // 9:22:23 PM CET
 * echo $formatter($datetime, 'medium'); // 9:22:23 PM
 * echo $formatter($datetime, 'short');  // 9:22 PM
 *
 * $formatter = new TimeFormatter($repository->locales['fr']);
 *
 * echo $formatter($datetime, 'full');   // 21:22:23 CET
 * echo $formatter($datetime, 'long');   // 21:22:23 CET
 * echo $formatter($datetime, 'medium'); // 21:22:23
 * echo $formatter($datetime, 'short');  // 21:22
 * </pre>
 */
class TimeFormatter extends DateTimeFormatter
{
    /**
     * Resolves widths defined in `timeFormats` (full, long, medium, short) into a pattern.
     *
     * @inheritdoc
     */
    protected function resolve_pattern($pattern_or_width_or_skeleton)
    {
        return parent::resolve_pattern($this->resolve_width($pattern_or_width_or_skeleton, 'timeFormats'));
    }
}
ICanBoogie/CLDR v1.6.0 API documentation generated by ApiGen