diff --git a/includes/common.inc b/includes/common.inc index 5ecdcddf6c4..a8964a630ec 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(). */