I have an XML
file I am parsing and then inserting into my database using PHP
. The date nodes however are in a weird XML
format that I believed to be milliseconds. My attempts to convert this so far have been unsuccessful and I was hoping someone could point out my error.
XML
<est__start>1335744000000</est__start>
<est__end>1342742400000</est__end>
Which was this much more readable date before being converted
<est__start> 04-30-2012 </est__start>
<est__end> 07-20-2012 </est__end>
PHP
$start = $data->est__start;
if (empty($start)) {
$start = '';
} else {
$start = intval($start);
$seconds = $start / 1000;
$start = date("d-m-Y", $seconds);
}
$end = $data->est__start;
if (empty($end)) {
$end = '';
} else {
$end = intval($end);
$seconds = $end / 1000;
$end = date("d-m-Y", $end);
}
The end result however is always something similar to this
25-01-1970
and I need it to look like it did before the conversion. Like this
04-30-2012
Since I'm not handling the original date conversion when it goes into the XML file I'm not sure where I'm going wrong. Any help is appreciated.