Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F99298843
PhabricatorEpochExportField.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Jan 23, 05:36
Size
991 B
Mime Type
text/x-php
Expires
Sat, Jan 25, 05:36 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23726062
Attached To
rPH Phabricator
PhabricatorEpochExportField.php
View Options
<?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
Log In to Comment