From e35e4cbd1e93fb350d9ed782597d68f5a3df5db8 Mon Sep 17 00:00:00 2001 From: Andreas Gohr <andi@splitbrain.org> Date: Sun, 27 Nov 2005 12:01:18 +0100 Subject: [PATCH] fixed date format for google sitemaps darcs-hash:20051127110118-7ad00-691b4d529004ef0571896c3d326361970a584409.gz --- lib/exe/indexer.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/exe/indexer.php b/lib/exe/indexer.php index 2eea32f02..2680d161a 100644 --- a/lib/exe/indexer.php +++ b/lib/exe/indexer.php @@ -113,7 +113,7 @@ function runSitemapper(){ print ' <url>'.NL; print ' <loc>'.wl($id,'',true).'</loc>'.NL; - print ' <lastmod>'.date('Y-m-d\TH:i:s',$date).'</lastmod>'.NL; + print ' <lastmod>'.date_iso8601($date).'</lastmod>'.NL; print ' </url>'.NL; } print '</urlset>'.NL; @@ -125,6 +125,21 @@ function runSitemapper(){ return true; } +/** + * Formats a timestamp as ISO 8601 date + * + * @author <ungu at terong dot com> + * @link http://www.php.net/manual/en/function.date.php#54072 + */ +function date_iso8601($int_date) { + //$int_date: current date in UNIX timestamp + $date_mod = date('Y-m-d\TH:i:s', $int_date); + $pre_timezone = date('O', $int_date); + $time_zone = substr($pre_timezone, 0, 3).":".substr($pre_timezone, 3, 2); + $date_mod .= $time_zone; + return $date_mod; +} + /** * Just send a 1x1 pixel blank gif to the browser * -- GitLab