[ Index ]

PHP Cross Reference of Limb3

title

Body

[close]

/wact/tests/cases/tags/core/ -> WactToDateFilterTest.class.php (source)

   1  <?php
   2  /*
   3   * Limb PHP Framework
   4   *
   5   * @link http://limb-project.com 
   6   * @copyright  Copyright &copy; 2004-2007 BIT(http://bit-creative.com)
   7   * @license    LGPL http://www.gnu.org/copyleft/lesser.html 
   8   */
   9  
  10  class WactToDateFilterTest extends WactTemplateTestCase
  11  {
  12    function testSimpleUse()
  13    {
  14      $template = '{$test|todate}';
  15      $this->registerTestingTemplate('/filters/core/todate/var.html', $template);
  16  
  17      $page = $this->initTemplate('/filters/core/todate/var.html');
  18      $page->set('test', 'April 3, 1970');
  19      $output = $page->capture();
  20      $check = mktime(0,0,0,4,3,1970);
  21      $this->assertEqual($output, $check);
  22    }
  23  
  24    function testEmptyDate()
  25    {
  26      $template = '{$test|todate}';
  27      $this->registerTestingTemplate('/filters/core/todate/empty_date.html', $template);
  28  
  29      $page = $this->initTemplate('/filters/core/todate/empty_date.html');
  30      $output = $page->capture();
  31      $this->assertEqual($output, '');
  32    }
  33  }
  34  
  35  /*

  36  per http://oss.software.ibm.com/icu/apiref/classSimpleDateFormat.html

  37  

  38  

  39  

  40    Symbol   Meaning                 Presentation        Example

  41   ------   -------                 ------------        -------

  42   G        era designator          (Text)              AD

  43   y        year                    (Number)            1996

  44   Y        year (week of year)     (Number)            1997

  45   u        extended year           (Number)            4601

  46   M        month in year           (Text & Number)     July & 07

  47   d        day in month            (Number)            10

  48   h        hour in am/pm (1~12)    (Number)            12

  49   H        hour in day (0~23)      (Number)            0

  50   m        minute in hour          (Number)            30

  51   s        second in minute        (Number)            55

  52   S        fractional second       (Number)            978

  53   E        day of week             (Text)              Tuesday

  54   e        day of week (local 1~7) (Number)            2

  55   D        day in year             (Number)            189

  56   F        day of week in month    (Number)            2 (2nd Wed in July)

  57   w        week in year            (Number)            27

  58   W        week in month           (Number)            2

  59   a        am/pm marker            (Text)              PM

  60   k        hour in day (1~24)      (Number)            24

  61   K        hour in am/pm (0~11)    (Number)            0

  62   z        time zone               (Text)              Pacific Standard Time

  63   Z        time zone (RFC 822)     (Number)            -0800

  64   g        Julian day              (Number)            2451334

  65   A        milliseconds in day     (Number)            69540000

  66   '        escape for text         (Delimiter)         'Date='

  67   ''       single quote            (Literal)           'o''clock'

  68  

  69  

  70  

  71  

  72  The count of pattern letters determine the format.

  73  

  74  (Text): 4 or more, use full form, <4, use short or abbreviated form if it exists. (e.g., "EEEE" produces "Monday", "EEE" produces "Mon")

  75  

  76  (Number): the minimum number of digits. Shorter numbers are zero-padded to this amount (e.g. if "m" produces "6", "mm" produces "06"). Year is handled specially; that is, if the count of 'y' is 2, the Year will be truncated to 2 digits. (e.g., if "yyyy" produces "1997", "yy" produces "97".) Unlike other fields, fractional seconds are padded on the right with zero.

  77  

  78  (Text & Number): 3 or over, use text, otherwise use number. (e.g., "M" produces "1", "MM" produces "01", "MMM" produces "Jan", and "MMMM" produces "January".)

  79  

  80  Any characters in the pattern that are not in the ranges of ['a'..'z'] and ['A'..'Z'] will be treated as quoted text. For instance, characters like ':', '.', ' ', '#' and '@' will appear in the resulting time text even they are not embraced within single quotes.

  81  

  82  A pattern containing any invalid pattern letter will result in a failing UErrorCode result during formatting or parsing.

  83  

  84  Examples using the US locale:

  85  

  86      Format Pattern                         Result

  87      --------------                         -------

  88      "yyyy.MM.dd G 'at' HH:mm:ss z"    ->>  1996.07.10 AD at 15:08:56 PDT

  89      "EEE, MMM d, ''yy"                ->>  Wed, July 10, '96

  90      "h:mm a"                          ->>  12:08 PM

  91      "hh 'o''clock' a, zzzz"           ->>  12 o'clock PM, Pacific Daylight Time

  92      "K:mm a, z"                       ->>  0:00 PM, PST

  93      "yyyyy.MMMMM.dd GGG hh:mm aaa"    ->>  1996.July.10 AD 12:08 PM

  94  

  95  

  96  */
  97  
  98  
  99  
 100  
 101  
 102  ?>


Generated: Thu Jan 8 04:06:23 2009 Cross-referenced by PHPXref 0.7