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


PHP w2p_Utilities_Date::findDaysInRangeOverlap方法代码示例

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


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

示例1: testFindDaysInRangeOverlap

 public function testFindDaysInRangeOverlap()
 {
     $base = new w2p_Utilities_Date();
     $Jan_01_2010 = new w2p_Utilities_Date('2010-01-01');
     $Jan_15_2010 = new w2p_Utilities_Date('2010-01-15');
     $Jan_01_2011 = new w2p_Utilities_Date('2011-01-01');
     $Jan_15_2011 = new w2p_Utilities_Date('2011-01-15');
     $Jan_31_2011 = new w2p_Utilities_Date('2011-01-31');
     $Feb_15_2011 = new w2p_Utilities_Date('2011-02-15');
     $Jan_16_2012 = new w2p_Utilities_Date('2012-01-16');
     $Jan_31_2012 = new w2p_Utilities_Date('2012-01-31');
     // No overlap, Range B after Range A
     $this->assertEquals(0, $base->findDaysInRangeOverlap($Jan_01_2011, $Jan_15_2011, $Jan_16_2012, $Jan_31_2012));
     // No overlap, Range B before Range A
     $this->assertEquals(0, $base->findDaysInRangeOverlap($Jan_01_2011, $Jan_15_2011, $Jan_01_2010, $Jan_15_2010));
     // Range B exactly matches Range A
     $Jan_01_2011 = new w2p_Utilities_Date('2011-01-01');
     $Jan_31_2011 = new w2p_Utilities_Date('2011-01-31');
     $this->assertEquals(21, $base->findDaysInRangeOverlap($Jan_01_2011, $Jan_31_2011, $Jan_01_2011, $Jan_31_2011));
     // Range B Start within Range A, Range B End after Range A
     $Jan_01_2011 = new w2p_Utilities_Date('2011-01-01');
     $Jan_15_2011 = new w2p_Utilities_Date('2011-01-15');
     $Jan_31_2011 = new w2p_Utilities_Date('2011-01-31');
     $Feb_15_2011 = new w2p_Utilities_Date('2011-02-15');
     $this->assertEquals(11, $base->findDaysInRangeOverlap($Jan_01_2011, $Jan_31_2011, $Jan_15_2011, $Feb_15_2011));
     // Range A entirely within Range B
     $Jan_01_2010 = new w2p_Utilities_Date('2010-01-01');
     $Jan_15_2011 = new w2p_Utilities_Date('2011-01-15');
     $Feb_15_2011 = new w2p_Utilities_Date('2011-02-15');
     $Jan_31_2012 = new w2p_Utilities_Date('2012-01-31');
     $this->assertEquals(22, $base->findDaysInRangeOverlap($Jan_15_2011, $Feb_15_2011, $Jan_01_2010, $Jan_31_2012));
     // Range B entirely within Range A
     $Jan_01_2010 = new w2p_Utilities_Date('2010-01-01');
     $Jan_15_2011 = new w2p_Utilities_Date('2011-01-15');
     $Feb_15_2011 = new w2p_Utilities_Date('2011-02-15');
     $Jan_31_2012 = new w2p_Utilities_Date('2012-01-31');
     $this->assertEquals(22, $base->findDaysInRangeOverlap($Jan_01_2010, $Jan_31_2012, $Jan_15_2011, $Feb_15_2011));
     // Range B Start before Range A, Range B End within Range A
     $Jan_01_2010 = new w2p_Utilities_Date('2010-01-01');
     $Jan_15_2011 = new w2p_Utilities_Date('2011-01-15');
     $Jan_31_2011 = new w2p_Utilities_Date('2011-01-31');
     $Feb_15_2011 = new w2p_Utilities_Date('2011-02-15');
     $this->assertEquals(11, $base->findDaysInRangeOverlap($Jan_15_2011, $Feb_15_2011, $Jan_01_2010, $Jan_31_2011));
 }
开发者ID:illuminate3,项目名称:web2project,代码行数:44,代码来源:DateTest.php


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