PHP Classes

Date Format Convert

Recommend this page to a friend!

      SimpleXLSX  >  All threads  >  Date Format Convert  >  (Un) Subscribe thread alerts  
Subject:Date Format Convert
Summary:Hi sergey, I had something to convert format date from xlsx, I u
Messages:1
Author:Anggie Aziz
Date:2012-12-10 05:50:45
 

  1. Date Format Convert   Reply   Report abuse  
Picture of Anggie Aziz Anggie Aziz - 2012-12-10 05:50:45
Hi sergey, I had something to convert format date from xlsx, I use this when converting xlsx to mysql :)
If you want, maybe you can add this for your next version of your lovely xlsx class
Here is the script :
function convert_date($date, $vend = 'Normal') {
if(stristr($date, '/') || stristr($date, '-')) {
$output = date("Y-m-d", strtotime($date));
} elseif(is_numeric($date)) {
if($vend=='Normal') $output = date("Y-m-d", $this->unixstamp($date));
else $output = date("Y-m-d", strtotime($date));
} else {
die("Date format is not supported");
}
return $output;
}

thanks sergey ...