| When generating RSS, or Sitemap, W3C Date Time Format string is used. In case of using xmlrpc, it contains W3C Date Time Format string conversion module such as w3cdatetime_encode, and w3cdatetime_decode.
If you don't use xmlrpc module, you can declare below module in order to use W3C Date Time Format string conversion module. Of course, if your PHP supports the function, you don't need to declare below functions.
// date helpers - added by kurapa 2008-02-12 function w3cdatetime_encode($timet, $utc=0) { if (!$utc) { $t=strftime("%Y-%m-%dT%H:%M:%S", $timet); } else { if (function_exists("gmstrftime")) // gmstrftime doesn't exist in some versions // of PHP $t=gmstrftime("%Y-%m-%dT%H:%M:%S", $timet); else { $t=strftime("%Y-%m-%dT%H:%M:%S", $timet-date("Z")); } } $t .= "+00:00"; return $t; }
function w3cdatetime_decode($idate, $utc=0) { // return a timet in the localtime, or UTC $t=0; if (ereg("([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})", $idate, $regs)) { if ($utc) { $t=gmmktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]); } else { $t=mktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]); } } return $t; } |