Skip to content
This repository has been archived by the owner on Jun 6, 2021. It is now read-only.

Patch 2 #18

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions php-export-data.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,13 @@ private function generateCell($item) {
// Note we want to be very strict in what we consider a date. There is the possibility
// of really screwing up the data if we try to reformat a string that was not actually
// intended to represent a date.
elseif(preg_match("/^(\d{1,2}|\d{4})[\/\-]\d{1,2}[\/\-](\d{1,2}|\d{4})([^\d].+)?$/",$item) &&
elseif(preg_match("/^(\d{1,2}|\d{4})[\/\-]\d{1,2}[\/\-](\d{4}|\d{1,2})([^\d].+)?$/",$item) &&
($timestamp = strtotime($item)) &&
($timestamp > 0) &&
($timestamp < strtotime('+500 years'))) {
$type = 'DateTime';
$item = strftime("%Y-%m-%dT%H:%M:%S",$timestamp);

//$item = strftime("%Y-%m-%dT%H:%M:%S",$timestamp);
$style = 'sDT'; // defined in header; tells excel to format date for display
}
else {
Expand All @@ -239,4 +240,4 @@ function sendHttpHeaders() {
header("Content-Disposition: inline; filename=\"" . basename($this->filename) . "\"");
}

}
}