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


PHP PHPExcel_Calculation_DateTime::DATEVALUE方法代码示例

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


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

示例1: testDATEVALUEtoPHPObject

 public function testDATEVALUEtoPHPObject()
 {
     PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT);
     $result = PHPExcel_Calculation_DateTime::DATEVALUE('2012-1-31');
     PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
     //    Must return an object...
     $this->assertTrue(is_object($result));
     //    ... of the correct type
     $this->assertTrue(is_a($result, 'DateTime'));
     //    ... with the correct value
     $this->assertEquals($result->format('d-M-Y'), '31-Jan-2012');
 }
开发者ID:MyPHPTools,项目名称:PHPExcel,代码行数:12,代码来源:DateTimeTest.php

示例2: TEXTFORMAT

 /**
  * TEXTFORMAT
  *
  * @param	mixed	$value	Value to check
  * @param	string	$format	Format mask to use
  * @return	boolean
  */
 public static function TEXTFORMAT($value, $format)
 {
     $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
     $format = PHPExcel_Calculation_Functions::flattenSingleValue($format);
     if (is_string($value) && !is_numeric($value) && PHPExcel_Shared_Date::isDateTimeFormatCode($format)) {
         $value = PHPExcel_Calculation_DateTime::DATEVALUE($value);
     }
     return (string) PHPExcel_Style_NumberFormat::toFormattedString($value, $format);
 }
开发者ID:EmmanuelTaborda2015,项目名称:kyron_modificado,代码行数:16,代码来源:TextData.php

示例3: VALUE

 /**
  * VALUE
  *
  * @param    mixed    $value    Value to check
  * @return    boolean
  */
 public static function VALUE($value = '')
 {
     $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
     if (!is_numeric($value)) {
         $numberValue = str_replace(PHPExcel_Shared_String::getThousandsSeparator(), '', trim($value, " \t\n\r\v" . PHPExcel_Shared_String::getCurrencyCode()));
         if (is_numeric($numberValue)) {
             return (double) $numberValue;
         }
         $dateSetting = PHPExcel_Calculation_Functions::getReturnDateType();
         PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
         if (strpos($value, ':') !== false) {
             $timeValue = PHPExcel_Calculation_DateTime::TIMEVALUE($value);
             if ($timeValue !== PHPExcel_Calculation_Functions::VALUE()) {
                 PHPExcel_Calculation_Functions::setReturnDateType($dateSetting);
                 return $timeValue;
             }
         }
         $dateValue = PHPExcel_Calculation_DateTime::DATEVALUE($value);
         if ($dateValue !== PHPExcel_Calculation_Functions::VALUE()) {
             PHPExcel_Calculation_Functions::setReturnDateType($dateSetting);
             return $dateValue;
         }
         PHPExcel_Calculation_Functions::setReturnDateType($dateSetting);
         return PHPExcel_Calculation_Functions::VALUE();
     }
     return (double) $value;
 }
开发者ID:oalkhanishvili,项目名称:track2,代码行数:33,代码来源:TextData.php

示例4: stringToExcel

 /**
  * Convert a date/time string to Excel time
  *
  * @param	string	$dateValue		Examples: '2009-12-31', '2009-12-31 15:59', '2009-12-31 15:59:10'
  * @return	float|FALSE		Excel date/time serial value
  */
 public static function stringToExcel($dateValue = '')
 {
     if (strlen($dateValue) < 2) {
         return FALSE;
     }
     if (!preg_match('/^(\\d{1,4}[ \\.\\/\\-][A-Z]{3,9}([ \\.\\/\\-]\\d{1,4})?|[A-Z]{3,9}[ \\.\\/\\-]\\d{1,4}([ \\.\\/\\-]\\d{1,4})?|\\d{1,4}[ \\.\\/\\-]\\d{1,4}([ \\.\\/\\-]\\d{1,4})?)( \\d{1,2}:\\d{1,2}(:\\d{1,2})?)?$/iu', $dateValue)) {
         return FALSE;
     }
     $dateValueNew = PHPExcel_Calculation_DateTime::DATEVALUE($dateValue);
     if ($dateValueNew === PHPExcel_Calculation_Functions::VALUE()) {
         return FALSE;
     } else {
         if (strpos($dateValue, ':') !== FALSE) {
             $timeValue = PHPExcel_Calculation_DateTime::TIMEVALUE($dateValue);
             if ($timeValue === PHPExcel_Calculation_Functions::VALUE()) {
                 return FALSE;
             }
             $dateValueNew += $timeValue;
         }
         return $dateValueNew;
     }
 }
开发者ID:nstungxd,项目名称:F2CA5,代码行数:28,代码来源:Date.php

示例5: stringToExcel

 /**
  * Convert a date/time string to Excel time
  *
  * @param	string	$dateValue		Examples: '2009-12-31', '2009-12-31 15:59', '2009-12-31 15:59:10'
  * @return	float|false		Excel date/time serial value
  */
 public static function stringToExcel($dateValue = '')
 {
     if (strlen($dateValue) < 2) {
         return false;
     }
     $dateValueNew = PHPExcel_Calculation_DateTime::DATEVALUE($dateValue);
     if ($dateValueNew === PHPExcel_Calculation_Functions::VALUE()) {
         return false;
     } else {
         if (strpos($dateValue, ':') !== false) {
             $timeValue = PHPExcel_Calculation_DateTime::TIMEVALUE($dateValue);
             if ($timeValue === PHPExcel_Calculation_Functions::VALUE()) {
                 return false;
             }
             $dateValueNew += $timeValue;
         }
         return $dateValueNew;
     }
 }
开发者ID:davidmottet,项目名称:automne,代码行数:25,代码来源:Date.php


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