Пример #1
0
 /**
  * Initialize a new DateFormat.
  * @param mixed either, null, a CultureInfo instance,
  * a DateTimeFormatInfo instance, or a locale.
  * @return DateFormat instance
  */
 function __construct($formatInfo = null)
 {
     if ($formatInfo === null) {
         $this->formatInfo = DateTimeFormatInfo::getInvariantInfo();
     } else {
         if ($formatInfo instanceof CultureInfo) {
             $this->formatInfo = $formatInfo->DateTimeFormat;
         } else {
             if ($formatInfo instanceof DateTimeFormatInfo) {
                 $this->formatInfo = $formatInfo;
             } else {
                 $this->formatInfo = DateTimeFormatInfo::getInstance($formatInfo);
             }
         }
     }
     $this->methods = get_class_methods($this);
 }
 function testGetInstance()
 {
     $format = DateTimeFormatInfo::getInstance('zh_CN');
     $pattern = 'yyyy-M-d';
     $this->assertEqual($pattern, $format->MediumDatePattern);
 }