当前位置: 首页>>代码示例>>PHP>>正文


PHP CakeTime::niceFormat方法代码示例

本文整理汇总了PHP中CakeTime::niceFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP CakeTime::niceFormat方法的具体用法?PHP CakeTime::niceFormat怎么用?PHP CakeTime::niceFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CakeTime的用法示例。


在下文中一共展示了CakeTime::niceFormat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testNice

 /**
  * testNice method
  *
  * @return void
  */
 public function testNice()
 {
     $time = time() + 2 * DAY;
     $this->assertEquals(date('D, M jS Y, H:i', $time), $this->Time->nice($time));
     $time = time() - 2 * DAY;
     $this->assertEquals(date('D, M jS Y, H:i', $time), $this->Time->nice($time));
     $time = time();
     $this->assertEquals(date('D, M jS Y, H:i', $time), $this->Time->nice($time));
     $time = 0;
     $this->assertEquals(date('D, M jS Y, H:i', time()), $this->Time->nice($time));
     $time = null;
     $this->assertEquals(date('D, M jS Y, H:i', time()), $this->Time->nice($time));
     $time = time();
     $this->assertEquals(date('D', $time), $this->Time->nice($time, null, '%a'));
     $this->assertEquals(date('M d, Y', $time), $this->Time->nice($time, null, '%b %d, %Y'));
     $this->Time->niceFormat = '%Y-%d-%m';
     $this->assertEquals(date('Y-d-m', $time), $this->Time->nice($time));
     $this->assertEquals('%Y-%d-%m', $this->Time->niceFormat);
     CakeTime::$niceFormat = '%Y-%d-%m %H:%M';
     $this->assertEquals(date('Y-d-m H:i', $time), $this->Time->nice($time));
     $this->assertEquals('%Y-%d-%m %H:%M', $this->Time->niceFormat);
     date_default_timezone_set('UTC');
     $result = $this->Time->nice(null, 'America/New_York');
     $expected = $this->Time->nice(time(), 'America/New_York');
     $this->assertEquals(substr($expected, 0, -1), substr($result, 0, -1));
     $this->_restoreSystemTimezone();
 }
开发者ID:terriblyuncreative,项目名称:moviedb,代码行数:32,代码来源:CakeTimeTest.php

示例2: testNice

 /**
  * testNice method
  *
  * @return void
  */
 public function testNice()
 {
     $time = time() + 2 * DAY;
     $this->assertEquals(date('D, M jS Y, H:i', $time), $this->Time->nice($time));
     $time = time() - 2 * DAY;
     $this->assertEquals(date('D, M jS Y, H:i', $time), $this->Time->nice($time));
     $time = time();
     $this->assertEquals(date('D, M jS Y, H:i', $time), $this->Time->nice($time));
     $time = 0;
     $this->assertEquals(date('D, M jS Y, H:i', time()), $this->Time->nice($time));
     $time = null;
     $this->assertEquals(date('D, M jS Y, H:i', time()), $this->Time->nice($time));
     $time = time();
     $this->assertEquals(date('D', $time), $this->Time->nice($time, null, '%a'));
     $this->assertEquals(date('M d, Y', $time), $this->Time->nice($time, null, '%b %d, %Y'));
     $this->Time->niceFormat = '%Y-%d-%m';
     $this->assertEquals(date('Y-d-m', $time), $this->Time->nice($time));
     $this->assertEquals('%Y-%d-%m', $this->Time->niceFormat);
     CakeTime::$niceFormat = '%Y-%d-%m %H:%M:%S';
     $this->assertEquals(date('Y-d-m H:i:s', $time), $this->Time->nice($time));
     $this->assertEquals('%Y-%d-%m %H:%M:%S', $this->Time->niceFormat);
 }
开发者ID:Juan09130424,项目名称:CakePHP---Bootstrap-template,代码行数:27,代码来源:CakeTimeTest.php


注:本文中的CakeTime::niceFormat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。