Autodoc
  • Namespace
  • Class
  • Tree

Namespaces

  • BlueTihi
    • Context
  • Brickrouge
    • Element
      • Nodes
    • Renderer
    • Widget
  • ICanBoogie
    • ActiveRecord
    • AutoConfig
    • CLDR
    • Composer
    • Core
    • Event
    • Exception
    • HTTP
      • Dispatcher
      • Request
    • I18n
      • Translator
    • Mailer
    • Modules
      • Taxonomy
        • Support
      • Thumbnailer
        • Versions
    • Object
    • Operation
      • Dispatcher
    • Prototype
    • Routes
    • Routing
      • Dispatcher
    • Session
  • Icybee
    • ActiveRecord
      • Model
    • ConfigOperation
    • Document
    • EditBlock
    • Element
      • ActionbarContextual
      • ActionbarSearch
      • ActionbarToolbar
    • FormBlock
    • Installer
    • ManageBlock
    • Modules
      • Articles
      • Cache
        • Collection
        • ManageBlock
      • Comments
        • ManageBlock
      • Contents
        • ManageBlock
      • Dashboard
      • Editor
        • Collection
      • Files
        • File
        • ManageBlock
      • Forms
        • Form
        • ManageBlock
      • I18n
      • Images
        • ManageBlock
      • Members
      • Modules
        • ManageBlock
      • Nodes
        • ManageBlock
        • Module
      • Pages
        • BreadcrumbElement
        • LanguagesElement
        • ManageBlock
        • NavigationBranchElement
        • NavigationElement
        • Page
        • PageController
      • Registry
      • Search
      • Seo
      • Sites
        • ManageBlock
      • Taxonomy
        • Terms
          • ManageBlock
        • Vocabulary
          • ManageBlock
      • Users
        • ManageBlock
        • NonceLogin
        • Roles
      • Views
        • ActiveRecordProvider
        • Collection
        • View
    • Operation
      • ActiveRecord
      • Constructor
      • Module
      • Widget
    • Rendering
  • None
  • Patron
  • PHP

Classes

  • Calendar
  • CalendarCollection
  • DateFormatter
  • DateTimeFormatter
  • FileCache
  • Locale
  • LocaleCollection
  • LocalizedDateTime
  • LocalizedObject
  • Provider
  • Repository
  • Retriever
  • RunTimeCache
  • Supplemental
  • TimeFormatter

Interfaces

  • Cache

Exceptions

  • ResourceNotFound
 1 <?php
 2 
 3 /*
 4  * This file is part of the ICanBoogie package.
 5  *
 6  * (c) Olivier Laviale <olivier.laviale@gmail.com>
 7  *
 8  * For the full copyright and license information, please view the LICENSE
 9  * file that was distributed with this source code.
10  */
11 
12 namespace ICanBoogie\CLDR;
13 
14 /**
15  * Date formatter.
16  *
17  * <pre>
18  * <?php
19  *
20  * namespace ICanBoogie\CLDR;
21  *
22  * $datetime = '2013-11-05 21:22:23';
23  *
24  * $formatter = new DateFormatter($repository->locales['en']);
25  *
26  * echo $formatter($datetime, 'full');   // Tuesday, November 5, 2013
27  * echo $formatter($datetime, 'long');   // November 5, 2013
28  * echo $formatter($datetime, 'medium'); // Nov 5, 2013
29  * echo $formatter($datetime, 'short');  // 11/5/13
30  *
31  * $formatter = new DateFormatter($repository->locales['fr']);
32  *
33  * echo $formatter($datetime, 'full');   // mardi 5 novembre 2013
34  * echo $formatter($datetime, 'long');   // 5 novembre 2013
35  * echo $formatter($datetime, 'medium'); // 5 nov. 2013
36  * echo $formatter($datetime, 'short');  // 05/11/2013
37  * </pre>
38  */
39 class DateFormatter extends DateTimeFormatter
40 {
41     /**
42      * Resolves widths defined in `dateFormats` (full, long, medium, short) into a pattern.
43      */
44     protected function resolve_pattern($pattern_or_width_or_skeleton)
45     {
46         static $widths = array('full', 'long', 'medium', 'short');
47 
48         if (in_array($pattern_or_width_or_skeleton, $widths))
49         {
50             return $this->calendar['dateFormats'][$pattern_or_width_or_skeleton];
51         }
52 
53         return parent::resolve_pattern($pattern_or_width_or_skeleton);
54     }
55 }
Autodoc API documentation generated by ApiGen 2.8.0