提供一个读取的函数:

 代码如下 复制代码

//excel日期转换函数
function excelTime($date, $time = false) {
 if(function_exists('GregorianToJD')){
  if (is_numeric( $date )) {
   $jd = GregorianToJD( 1, 1, 1970 );
   $gregorian = JDToGregorian( $jd + intval ( $date ) - 25569 );
   $date = explode( '/', $gregorian );
   $date_str = str_pad( $date [2], 4, '0', STR_PAD_LEFT )
      ."-". str_pad( $date [0], 2, '0', STR_PAD_LEFT )
      ."-". str_pad( $date [1], 2, '0', STR_PAD_LEFT )
      . ($time ? " 00:00:00" : '');
   return $date_str;
  }
 }else{
  $date=$date>25568?$date+1:25569;
  /*There was a bug if Converting date before 1-1-1970 (tstamp 0)*/
  $ofs=(70 * 365 + 17+2) * 86400;
  $date =  date("Y-m-d",($date * 86400) - $ofs).($time ? " 00:00:00" : '');
 }
 return $date;
}

 

php读取excel日期类型数据的例子的更多相关文章

  1. [Python]xlrd 读取excel 日期类型2种方式

    有个excle表格须要做一些过滤然后写入数据库中,可是日期类型的cell取出来是个数字,于是查询了下解决的办法. 主要的代码结构 data = xlrd.open_workbook(EXCEL_PAT ...

  2. NPOI读取Excel日期类型单元格返回一串数字问题

    public string getCellStringNEW(int row, int column) { try { ICell cell = xlSheet.GetRow(row).Cells[c ...

  3. 读取Excel表格日期类型数据的时候

    用POI读取Excel数据:(版本号:POI3.7) 1.读取Excel 2.Excel数据处理: Excel存储日期.时间均以数值类型进行存储,读取时POI先判断是是否是数值类型,再进行判断转化 1 ...

  4. java通过poi读取excel中的日期类型数据或自定义类型日期

    Java 读取Excel表格日期类型数据的时候,读出来的是这样的  12-十月-2019,而Excel中输入的是 2019/10/12 或 2019-10-12 poi处理excel时,当excel没 ...

  5. JXL读取Excel日期时间不准确

    XL读取Excel日期时间多出了8个小时. Cell c = rs.getCell(j, i);                     if (c.getType() == CellType.DAT ...

  6. C# 读取Excel日期格式

    读取Excel日期数据,一种方式是在EXCEL中把你的日期列的格式设置一下,设成"文本"型. 如果单元格格式设置为date,则在后台读出的数值是一个数值,如2008-08-08读出 ...

  7. 无法读取Excel中的数据单元格。有数据,但是读出来全是空值

    C#读取Excel,取值为空的解决办法! C#读取Excel遇到无法读取的解决方法是什么呢?这样在C#读取Excel的过程中有很多问题,那么本文就向你介绍如何解决C#读取Excel遇到无法读取的解决方 ...

  8. sql 读取excel中的数据

    select 列名 as 字段名 from openBowSet('MSDASQL.1','driver=Microsoft Excel Driver(*.xls);dbq=文件存放地址','sele ...

  9. json进阶(一)js读取解析JSON类型数据

    js读取解析JSON类型数据 一.什么是JSON? JSON(JavaScript Object Notation) 是一种轻量级的数据交换格式,采用完全独立于语言的文本格式,是理想的数据交换格式,同 ...

随机推荐

  1. 解决Intellij IDEA 通过archetype创建Maven项目缓慢的问题

    1.由于默认情况下,根据archetype创建maven项目会从网络下载catalog文件,导致创建maven项目缓慢 Searching for remote catalog: http://rep ...

  2. 使用spring + cxf +tomcat构建webservice

    这里使用maven构建的项目. 首先,我们构建一个maven项目: 然后将pom.xml文件中的内容拷贝到新建项目的pon.xml文件中: <project xmlns="http:/ ...

  3. 常用排序算法之JavaScript实现

    1.插入排序 1)算法简介 插入排序(Insertion-Sort)的算法描述是一种简单直观的排序算法.它的工作原理是通过构建有序序列,对于未排序数据,在已排序序列中从 后向前扫描,找到相应位置并插入 ...

  4. 怒刷DP之 HDU 1029

    Ignatius and the Princess IV Time Limit:1000MS     Memory Limit:32767KB     64bit IO Format:%I64d &a ...

  5. System.Data.OracleClient requires Oracle client software version 8.1.7 or greater

    It is a security issue, so to fix it simply do the following: Go to the Oracle folder. 1- Right Clic ...

  6. codeforces 680B B. Bear and Finding Criminals(水题)

    题目链接: B. Bear and Finding Criminals //#include <bits/stdc++.h> #include <vector> #includ ...

  7. selenium遍历控件集合

    场景:需要重复增加地址栏信息,如果地址信息超过了5个就不开始增加 如图: 1.找到控件集合,在遍历每个子元素,在进行选择 1.先找到最外层的div的控件集合 2.外层的css定位为: int star ...

  8. C# 序列化JavaScriptSerializer

    1.首先引入 System.Web.Extensions.dll 2.写入命名空间 System.Web.Script.Serialization 3.实现序列化. class Program { s ...

  9. 使用Gmail发送邮件心得

    /// <summary> /// 发送邮件 /// </summary> /// <returns></returns> public static ...

  10. 为什么用服务不用线程-Android

    1.什么是Service? A Service is an application component representing either an application's desire to p ...