當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Date_DateObject::date方法代碼示例

本文整理匯總了PHP中Zend_Date_DateObject::date方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Date_DateObject::date方法的具體用法?PHP Zend_Date_DateObject::date怎麽用?PHP Zend_Date_DateObject::date使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend_Date_DateObject的用法示例。


在下文中一共展示了Zend_Date_DateObject::date方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testDate

 public function testDate()
 {
     $date = new Zend_Date_DateObject(0);
     $this->assertTrue($date->date('U') > 0);
     $this->assertSame($date->date('U', 0), '0');
     $this->assertSame($date->date('U', 0, false), '0');
     $this->assertSame($date->date('U', 0, true), '0');
     $this->assertSame($date->date('U', 6900000000), '6900003600');
     $this->assertSame($date->date('U', -7000000000), '-6999996400');
     $this->assertSame($date->date('d', -7000000000), '06');
     $this->assertSame($date->date('D', -7000000000), 'Wed');
     $this->assertSame($date->date('j', -7000000000), '6');
     $this->assertSame($date->date('l', -7000000000), 'Wednesday');
     $this->assertSame($date->date('N', -7000000000), '3');
     $this->assertSame($date->date('S', -7000000000), 'th');
     $this->assertSame($date->date('w', -7000000000), '3');
     $this->assertSame($date->date('z', -7000000000), '65');
     $this->assertSame($date->date('W', -7000000000), '10');
     $this->assertSame($date->date('F', -7000000000), 'March');
     $this->assertSame($date->date('m', -7000000000), '03');
     $this->assertSame($date->date('M', -7000000000), 'Mar');
     $this->assertSame($date->date('n', -7000000000), '3');
     $this->assertSame($date->date('t', -7000000000), '31');
     $this->assertSame($date->date('T', -7000000000), 'CET');
     $this->assertSame($date->date('L', -7000000000), '1');
     $this->assertSame($date->date('o', -7000000000), '1748');
     $this->assertSame($date->date('Y', -7000000000), '1748');
     $this->assertSame($date->date('y', -7000000000), '48');
     $this->assertSame($date->date('a', -7000000000), 'pm');
     $this->assertSame($date->date('A', -7000000000), 'PM');
     $this->assertSame($date->date('B', -7000000000), '523');
     $this->assertSame($date->date('g', -7000000000), '12');
     $this->assertSame($date->date('G', -7000000000), '12');
     $this->assertSame($date->date('h', -7000000000), '12');
     $this->assertSame($date->date('H', -7000000000), '12');
     $this->assertSame($date->date('i', -7000000000), '33');
     $this->assertSame($date->date('s', -7000000000), '20');
     $this->assertSame($date->date('e', -7000000000), 'Europe/Paris');
     $this->assertSame($date->date('I', -7000000000), '0');
     $this->assertSame($date->date('O', -7000000000), '+0100');
     $this->assertSame($date->date('P', -7000000000), '+01:00');
     $this->assertSame($date->date('T', -7000000000), 'CET');
     $this->assertSame($date->date('Z', -7000000000), '3600');
     $this->assertSame($date->date('c', -7000000000), '1748-3-06T12:33:20+01:00');
     $this->assertSame($date->date('r', -7000000000), 'Wed, 06 Mar 1748 12:33:20 +0100');
     $this->assertSame($date->date('U', -7000000000), '-6999996400');
     $this->assertSame($date->date('\\H', -7000000000), 'H');
     $this->assertSame($date->date('.', -7000000000), '.');
     $this->assertSame($date->date('H:m:s', -7000000000), '12:03:20');
     $this->assertSame($date->date('d-M-Y', -7000000000), '06-Mar-1748');
     $this->assertSame($date->date('U', 6900000000, true), '6900000000');
     $this->assertSame($date->date('B', 6900000000, true), '152');
     $this->assertSame($date->date('g', 6899993000, true), '12');
     $this->assertSame($date->date('g', 6899997000, true), '1');
     $this->assertSame($date->date('g', 6900039200, true), '1');
     $this->assertSame($date->date('h', 6899993000, true), '12');
     $this->assertSame($date->date('h', 6899997000, true), '01');
     $this->assertSame($date->date('h', 6900040200, true), '01');
     $this->assertSame($date->date('e', -7000000000, true), 'UTC');
     $this->assertSame($date->date('I', -7000000000, true), '0');
     $this->assertSame($date->date('T', -7000000000, true), 'GMT');
     $this->assertSame($date->date('N', 6899740800, true), '6');
     $this->assertSame($date->date('S', 6900518000, true), 'st');
     $this->assertSame($date->date('S', 6900604800, true), 'nd');
     $this->assertSame($date->date('S', 6900691200, true), 'rd');
     $this->assertSame($date->date('N', 6900432000, true), '7');
 }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:67,代碼來源:DateObjectTest.php


注:本文中的Zend_Date_DateObject::date方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。