From d4d1522c3e36cdf5f3655ca1a9e8c9d0afe6cc41 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 18 Oct 2009 18:32:27 +0000 Subject: =?UTF-8?q?-=20Patch=20#607896=20by=20Benjamin=20Melan=C3=A7on,=20?= =?UTF-8?q?scor:=20add=20date=5Fiso8601()=20function=20to=20common.inc.=20?= =?UTF-8?q?Part=20of=20the=20RDFa=20exception.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- includes/common.inc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'includes') diff --git a/includes/common.inc b/includes/common.inc index 5ecdcddf6..a8964a630 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -2279,6 +2279,22 @@ function format_date($timestamp, $type = 'medium', $format = '', $timezone = NUL return preg_replace_callback('/\xEF([AaeDlMTF]?)(.*?)\xFF/', '_format_date_callback', $format); } +/** + * Returns an ISO8601 formatted date based on the given date. + * + * Can be used as a callback for RDF mappings. + * + * @param $date + * A UNIX timestamp. + * @return string + * An ISO8601 formatted date. + */ +function date_iso8601($date) { + // The DATE_ISO8601 constant cannot be used here because it does not match + // date('c') and produces invalid RDF markup. + return date('c', $date); +} + /** * Callback function for preg_replace_callback(). */ -- cgit v1.2.3