Page MenuHomec4science

PhabricatorEpochExportField.php
No OneTemporary

File Metadata

Created
Thu, Jan 23, 05:36

PhabricatorEpochExportField.php

<?php
final class PhabricatorEpochExportField
extends PhabricatorExportField {
private $zone;
public function getTextValue($value) {
if (!isset($this->zone)) {
$this->zone = new DateTimeZone('UTC');
}
try {
$date = new DateTime('@'.$value);
} catch (Exception $ex) {
return null;
}
$date->setTimezone($this->zone);
return $date->format('c');
}
public function getNaturalValue($value) {
return (int)$value;
}
public function getPHPExcelValue($value) {
$epoch = $this->getNaturalValue($value);
$seconds_per_day = phutil_units('1 day in seconds');
$offset = ($seconds_per_day * 25569);
return ($epoch + $offset) / $seconds_per_day;
}
/**
* @phutil-external-symbol class PHPExcel_Style_NumberFormat
*/
public function formatPHPExcelCell($cell, $style) {
$code = PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD2;
$style
->getNumberFormat()
->setFormatCode($code);
}
}

Event Timeline