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


PHP gmgetdate函数代码示例

本文整理汇总了PHP中gmgetdate函数的典型用法代码示例。如果您正苦于以下问题:PHP gmgetdate函数的具体用法?PHP gmgetdate怎么用?PHP gmgetdate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: _getCellDetails

 function _getCellDetails($spos, $numValue, $column)
 {
     $xfindex = ord($this->data[$spos + 4]) | ord($this->data[$spos + 5]) << 8;
     $xfrecord = $this->xfRecords[$xfindex];
     $type = $xfrecord['type'];
     $format = $xfrecord['format'];
     $formatIndex = $xfrecord['formatIndex'];
     $fontIndex = $xfrecord['fontIndex'];
     $formatColor = "";
     $rectype = '';
     $string = '';
     $raw = '';
     if (isset($this->_columnsFormat[$column + 1])) {
         $format = $this->_columnsFormat[$column + 1];
     }
     if ($type == 'date') {
         // See http://groups.google.com/group/php-excel-reader-discuss/browse_frm/thread/9c3f9790d12d8e10/f2045c2369ac79de
         $rectype = 'date';
         // Convert numeric value into a date
         $utcDays = floor($numValue - ($this->nineteenFour ? SPREADSHEET_EXCEL_READER_UTCOFFSETDAYS1904 : SPREADSHEET_EXCEL_READER_UTCOFFSETDAYS));
         $utcValue = $utcDays * SPREADSHEET_EXCEL_READER_MSINADAY;
         $dateinfo = gmgetdate($utcValue);
         $raw = $numValue;
         $fractionalDay = $numValue - floor($numValue) + 1.0E-7;
         // The .0000001 is to fix for php/excel fractional diffs
         $totalseconds = floor(SPREADSHEET_EXCEL_READER_MSINADAY * $fractionalDay);
         $secs = $totalseconds % 60;
         $totalseconds -= $secs;
         $hours = floor($totalseconds / (60 * 60));
         $mins = floor($totalseconds / 60) % 60;
         $string = date($format, mktime($hours, $mins, $secs, $dateinfo["mon"], $dateinfo["mday"], $dateinfo["year"]));
     } else {
         if ($type == 'number') {
             $rectype = 'number';
             $formatted = $this->_format_value($format, $numValue, $formatIndex);
             $string = $formatted['string'];
             $formatColor = $formatted['formatColor'];
             $raw = $numValue;
         } else {
             if ($format == "") {
                 $format = $this->_defaultFormat;
             }
             $rectype = 'unknown';
             $formatted = $this->_format_value($format, $numValue, $formatIndex);
             $string = $formatted['string'];
             $formatColor = $formatted['formatColor'];
             $raw = $numValue;
         }
     }
     return array('string' => $string, 'raw' => $raw, 'rectype' => $rectype, 'format' => $format, 'formatIndex' => $formatIndex, 'fontIndex' => $fontIndex, 'formatColor' => $formatColor, 'xfIndex' => $xfindex);
 }
开发者ID:nsalam,项目名称:Libska,代码行数:51,代码来源:exelreader.php

示例2: xls_import

 function xls_import($id, $returl = '')
 {
     global $_CAMILA;
     require_once CAMILA_DIR . 'datagrid/form.class.php';
     require_once CAMILA_DIR . 'datagrid/elements/form/hidden.php';
     require_once CAMILA_DIR . 'datagrid/elements/form/filebox.php';
     require_once CAMILA_DIR . 'datagrid/elements/form/static_listbox.php';
     //if ($returl != '')
     //    $form3 = new phpform('camilastep4', $returl);
     //else
     $form3 = new phpform('camilastep4', 'cf_worktable_wizard_step4.php');
     $form3->submitbutton = camila_get_translation('camila.wizard.next');
     $form3->drawrules = false;
     new form_hidden($form3, 'custom', $id);
     if ($returl != '') {
         new form_hidden($form3, 'returl', $_REQUEST['camila_returl']);
     }
     new form_filebox($form3, 'filename', camila_get_translation('camila.worktable.xls.choose'), 50, CAMILA_TMP_DIR);
     $sheet_list = '';
     for ($i = 0; $i < 10; $i++) {
         if ($i > 0) {
             $sheet_list .= ',';
         }
         $sheet_list .= $i . ';' . ($i + 1);
     }
     new form_static_listbox($form3, 'sheetnum', camila_get_translation('camila.worktable.xls.sheetnum'), $sheet_list);
     $success = true;
     if ($form3->process()) {
         $filename = $form3->fields['filename']->value[0];
         $sheetnum = $form3->fields['sheetnum']->value;
         $result = $_CAMILA['db']->Execute('select short_title, scriptname, tablename, filename, sheetnum from ' . CAMILA_TABLE_WORKT . ' where id=' . $_CAMILA['db']->qstr($id));
         if ($result === false) {
             camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $_CAMILA['db']->ErrorMsg());
         }
         $table = $result->fields['tablename'];
         $worktablename = $result->fields['short_title'];
         $worktablescript = $result->fields['scriptname'];
         if ($filename == '' && $result->fields['filename'] != '') {
             $filename = $result->fields['filename'];
             $sheetnum = $result->fields['sheetnum'];
         }
         if ($filename != '') {
             require_once CAMILA_LIB_DIR . 'php-excel-reader/excel_reader2.php';
             $data = new Spreadsheet_Excel_Reader(CAMILA_TMP_DIR . '/' . $filename);
             $excelColNames = array();
             $i = 0;
             while ($data->val(1, $i + 1, $sheetnum) != '') {
                 $name = $data->val(1, $i + 1, $sheetnum);
                 $excelColNames[$i] = camila_strtoupper_utf8(isUTF8($name) ? $name : utf8_encode($name));
                 $i++;
             }
             $result = $_CAMILA['db']->Execute('select * from ' . CAMILA_TABLE_WORKC . ' where (wt_id=' . $_CAMILA['db']->qstr($id) . ' and is_deleted<>' . $_CAMILA['db']->qstr('y') . ') order by sequence');
             if ($result === false) {
                 camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $_CAMILA['db']->ErrorMsg());
             }
             $fields = array();
             $types = array();
             $defVals = array();
             $forceCase = array();
             $orig_types = array();
             $fieldMapping = array();
             $forceArr = camila_get_translation_array('camila.worktable.options.force');
             $count = 0;
             while (!$result->EOF) {
                 $colName = $result->fields['col_name'];
                 $name = camila_strtoupper_utf8($result->fields['name']);
                 $fieldMapping[$colName] = isUTF8($name) ? $name : utf8_encode($name);
                 $fields[$count] = $colName;
                 $types[$count] = $result->fields['type'];
                 $orig_types[$count] = $result->fields['orig_type'];
                 $defVals[$count] = $result->fields['default_value'];
                 $forceCase[$count] = $result->fields['force_case'];
                 $count++;
                 $result->MoveNext();
             }
             $successCount = 0;
             $failCount = 0;
             //db fields
             for ($i = 2; $i <= $data->rowcount($sheetnum); $i++) {
                 $record = array();
                 $emptyrow = true;
                 //db fields
                 reset($fields);
                 foreach ($fields as $k => $v) {
                     //k  Field position into database
                     //k2 Position in Excel file
                     $k2 = array_search($fieldMapping[$v], $excelColNames);
                     //Is it in Excel file?
                     if ($k2 !== false) {
                         $excelColName = camila_strtoupper_utf8($data->value(1, $k2 + 1, $sheetnum));
                         //$excelColName = $v;
                         $worktableColName = array_search($excelColName, $fieldMapping);
                         $worktableColName = $v;
                         if ($worktableColName != '') {
                             if ($types[$k] == 'date' && $data->val($i, $k2 + 1, $sheetnum) != '') {
                                 $numValue = $data->sheets[$sheetnum]['cellsInfo'][$i][$k2 + 1]['raw'];
                                 $utcDays = floor($numValue - ($data->nineteenFour ? SPREADSHEET_EXCEL_READER_UTCOFFSETDAYS1904 : SPREADSHEET_EXCEL_READER_UTCOFFSETDAYS));
                                 $utcValue = $utcDays * SPREADSHEET_EXCEL_READER_MSINADAY;
                                 $dateinfo = gmgetdate($utcValue);
                                 $fractionalDay = $numValue - floor($numValue) + 1.0E-7;
//.........这里部分代码省略.........
开发者ID:umbecr,项目名称:camilaframework,代码行数:101,代码来源:configurator.class.php


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