This format you put in the question stores the time in the last five hexadecimal digits, and the rest is the date (both with an adjustment factor).
You can make a conversion from NFA to timestamp with this formula:
function nfaToTs($nfa) {
$nfadata = hexdec(substr($nfa,0,-5));
$nfahora = hexdec(substr($nfa,-5));
return ($nfadata-25569) * 86400 + ($nfahora - 7) / 11.574;
}
Mode of use:
$timestamp = nfaToTs('A70171480');
// Formate como quiser depois:
echo gmdate('Y-m-d H:i:s', $timestamp);
See working on IDEONE.
Of timestamp for NFA, it is mere inversion of logic:
function tsToNfa($ts) {
$hexdata = substr('0000' .dechex($ts / 86400 + 25569 ), -4);
$hexhora = substr('00000'.dechex($ts % 86400 * 11.574 + 7), -5);
return $hexdata.$hexhora;
}
Mode of use:
// qualquer coisa que retorne um timestamp
$ts = strtotime('1980-01-31 15:53:09 GMT');
echo tsToNfa($ts);
See working on IDEONE.
Curiosities:
The number of days between the Posix timestamp and the first day of the year 1900 is 25567
, perhaps the constant 25569
have some relationship with this 70 year setting;
in hexa, the decimal 1.000.000
is 0xF4240
, which is the NFA time limit;
one day has 86400
seconds, and as we divide 1.000.000
for 86.400
the result by chance is 11.574
;
Further reading:
How hexadecimal numbers work?
http://php.net/manual/en/function.hexdec.php