summaryrefslogtreecommitdiffstats
path: root/system/helpers/date_helper.php
diff options
context:
space:
mode:
authoradmin <devnull@localhost>2006-10-02 08:46:16 +0200
committeradmin <devnull@localhost>2006-10-02 08:46:16 +0200
commite8f6eb62a0600daf5b192746e1eed3e81516bc92 (patch)
tree0f2c39dda00a4adf6d01a596ce977962b2c2a12a /system/helpers/date_helper.php
parent3cad41e56fe4edc057cf6a84952a343686376429 (diff)
Diffstat (limited to 'system/helpers/date_helper.php')
-rw-r--r--system/helpers/date_helper.php38
1 files changed, 37 insertions, 1 deletions
diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php
index ab3a31867..987658c2e 100644
--- a/system/helpers/date_helper.php
+++ b/system/helpers/date_helper.php
@@ -92,7 +92,43 @@ function mdate($datestr = '', $time = '')
// ------------------------------------------------------------------------
/**
- * Convert MySQL Style Datecodes
+ * Standard Date
+ *
+ * Returns a date formatted according to the submitted standard.
+ *
+ * @access public
+ * @param string the chosen format
+ * @param integer Unix timestamp
+ * @return string
+ */
+function standard_date($fmt = 'DATE_RFC822', $time = '')
+{
+ $formats = array(
+ 'DATE_ATOM' => '%Y-%m-%dT%H:%i:%s%Q',
+ 'DATE_COOKIE' => '%l, %d-%M-%y %H:%i:%s UTC',
+ 'DATE_ISO8601' => '%Y-%m-%dT%H:%i:%s%O',
+ 'DATE_RFC822' => '%D, %d %M %y %H:%i:%s %O',
+ 'DATE_RFC850' => '%l, %d-%M-%y %H:%m:%i UTC',
+ 'DATE_RFC1036' => '%D, %d %M %y %H:%i:%s %O',
+ 'DATE_RFC1123' => '%D, %d %M %Y %H:%i:%s %O',
+ 'DATE_RFC2822' => '%D, %d %M %Y %H:%i:%s %O',
+ 'DATE_RSS' => '%D, %d %M %Y %H:%i:%s %O',
+ 'DATE_W3C' => '%Y-%m-%dT%H:%i:%s%Q'
+ );
+
+ if ( ! isset($formats[$fmt]))
+ {
+ return FALSE;
+ }
+
+ return mdate($formats[$fmt], $time);
+}
+
+
+// ------------------------------------------------------------------------
+
+/**
+ * Timespan
*
* Returns a span of seconds in this format:
* 10 days 14 hours 36 minutes 47 seconds