当前位置: 首页>>代码示例>>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;未经允许,请勿转载。