Home >Backend Development >PHP Tutorial >excelTime is used to import date format in excel

excelTime is used to import date format in excel

WBOY
WBOYOriginal
2016-07-25 08:48:431011browse
Used to import date format in excel and format it into year, month and day format
                 
                                                                                                                                                                                                                                                                                                                     


function excelTime($days, $time=false,$str='-'){
if(!$days)return false;
    if(function_exists("gregoriantojd")){
  1. if(is_numeric($ days)){
  2.                                                                                                                                                                                    569);
  3.                     $myDate = explode ('/',$gregorian);
  4.                   $myDateStr = str_pad($myDate[2],4,'0', STR_PAD_LEFT)
  5.                                                                                                                                                     $myDateStr _PAD_LEFT)
  6.                                            .$str.str_pad($myDate[1],2,'0', STR_PAD_LEFT)             ;
  7.                                                                                                                       return $myDateStr;
  8. $date=$days>25568?$days+1:25569;
  9. $ofs=(70 * 365 + 17+2) * 86400;
  10. $days = date("Y".$str."m".$ str."d",($date * 86400) - $ofs).($time ? " 00:00:00" : "");
  11. }
  12.                                                                                                   str.
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn