summaryrefslogtreecommitdiffstats
path: root/system/helpers/date_helper.php
diff options
context:
space:
mode:
Diffstat (limited to 'system/helpers/date_helper.php')
-rw-r--r--system/helpers/date_helper.php28
1 files changed, 13 insertions, 15 deletions
diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php
index 9637e26ce..6686089c6 100644
--- a/system/helpers/date_helper.php
+++ b/system/helpers/date_helper.php
@@ -121,22 +121,20 @@ if ( ! function_exists('standard_date'))
* @param int Unix timestamp
* @return string
*/
- function standard_date($fmt = 'DATE_RFC822', $time = '')
+ function standard_date($fmt = 'DATE_RFC822', $time = NULL)
{
- $formats = array(
- 'DATE_ATOM' => '%Y-%m-%dT%H:%i:%s%P',
- 'DATE_COOKIE' => '%l, %d-%M-%y %H:%i:%s UTC',
- 'DATE_ISO8601' => '%Y-%m-%dT%H:%i:%s%P',
- 'DATE_RFC822' => '%D, %d %M %y %H:%i:%s %O',
- 'DATE_RFC850' => '%l, %d-%M-%y %H:%i:%s UTC',
- 'DATE_RFC1036' => '%D, %d %M %y %H:%i:%s %O',
- 'DATE_RFC1123' => '%D, %d %M %Y %H:%i:%s %O',
- 'DATE_RFC2822' => '%r',
- 'DATE_RSS' => '%D, %d %M %Y %H:%i:%s %O',
- 'DATE_W3C' => '%Y-%m-%dT%H:%i:%s%P'
- );
-
- return isset($formats[$fmt]) ? mdate($formats[$fmt], $time) : FALSE;
+ if (empty($time))
+ {
+ $time = now();
+ }
+
+ // Procedural style pre-defined constants from the DateTime extension
+ if (strpos($fmt, 'DATE_') !== 0 OR defined($fmt) === FALSE)
+ {
+ return FALSE;
+ }
+
+ return date(constant($fmt), $time);
}
}