I have this so far:
function Date(T) if not T then return "never" end local Z = math.floor(T/86400)+719468 local ERA = math.floor(Z/146097)