diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-10-18 18:32:27 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-10-18 18:32:27 +0000 |
commit | d4d1522c3e36cdf5f3655ca1a9e8c9d0afe6cc41 (patch) | |
tree | eae35383c8ea9db1e6dcb5bde32b09e5fb22ce7a /includes | |
parent | ef6a7dbbc0d46c60a97fe0baf1e26def20294703 (diff) | |
download | brdo-d4d1522c3e36cdf5f3655ca1a9e8c9d0afe6cc41.tar.gz brdo-d4d1522c3e36cdf5f3655ca1a9e8c9d0afe6cc41.tar.bz2 |
- Patch #607896 by Benjamin Melançon, scor: add date_iso8601() function to common.inc. Part of the RDFa exception.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/common.inc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/includes/common.inc b/includes/common.inc index 5ecdcddf6..a8964a630 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -2280,6 +2280,22 @@ function format_date($timestamp, $type = 'medium', $format = '', $timezone = NUL } /** + * 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(). */ function _format_date_callback(array $matches = NULL, $new_langcode = NULL) { |