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


PHP PHPExcel_Calculation_DateTime::_getDateValue方法代码示例

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


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

示例1: TBILLYIELD

 /**
  * TBILLYIELD
  *
  * Returns the yield for a Treasury bill.
  *
  * @param	mixed	settlement	The Treasury bill's settlement date.
  *								The Treasury bill's settlement date is the date after the issue date when the Treasury bill is traded to the buyer.
  * @param	mixed	maturity	The Treasury bill's maturity date.
  *								The maturity date is the date when the Treasury bill expires.
  * @param	int		price		The Treasury bill's price per $100 face value.
  * @return	float
  */
 public static function TBILLYIELD($settlement, $maturity, $price)
 {
     $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
     $maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
     $price = PHPExcel_Calculation_Functions::flattenSingleValue($price);
     //	Validate
     if (is_numeric($price)) {
         if ($price <= 0) {
             return PHPExcel_Calculation_Functions::NaN();
         }
         if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
             ++$maturity;
             $daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity) * 360;
             if (!is_numeric($daysBetweenSettlementAndMaturity)) {
                 //	return date error
                 return $daysBetweenSettlementAndMaturity;
             }
         } else {
             $daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::_getDateValue($maturity) - PHPExcel_Calculation_DateTime::_getDateValue($settlement);
         }
         if ($daysBetweenSettlementAndMaturity > 360) {
             return PHPExcel_Calculation_Functions::NaN();
         }
         return (100 - $price) / $price * (360 / $daysBetweenSettlementAndMaturity);
     }
     return PHPExcel_Calculation_Functions::VALUE();
 }
开发者ID:arjunkumar786,项目名称:faces,代码行数:39,代码来源:Financial.php


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