- Patch #607896 by Benjamin Melançon, scor: add date_iso8601() function to common.inc. Part of the RDFa exception.

merge-requests/26/head
Dries Buytaert 2009-10-18 18:32:27 +00:00
parent ef6a7dbbc0
commit d4d1522c3e
1 changed files with 16 additions and 0 deletions

View File

@ -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().
*/