cvs: pearweb /include pear-format-html.php
| From: | Helgi �ormar �orbj�rnsson | Date: | Sun, 30 Mar 2008 22:33:53 +0000 |
| Subject: | cvs: pearweb /include pear-format-html.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-7427@lists.php.net to get a copy of this message | ||
dufuz Sun Mar 30 22:33:53 2008 UTC
Modified files:
/pearweb/include pear-format-html.php
Log:
Move format_date from bugs/include/functions.inc here since it will be replacing make_utc_date,
they do the same and format_date is a better function name
http://cvs.php.net/viewvc.cgi/pearweb/include/pear-format-html.php?r1=1.265&r2=1.266&diff_format=u
Index: pearweb/include/pear-format-html.php
diff -u pearweb/include/pear-format-html.php:1.265 pearweb/include/pear-format-html.php:1.266
--- pearweb/include/pear-format-html.php:1.265 Sun Mar 30 21:58:50 2008
+++ pearweb/include/pear-format-html.php Sun Mar 30 22:33:53 2008
@@ -15,7 +15,7 @@
+----------------------------------------------------------------------+
| Authors: |
+----------------------------------------------------------------------+
- $Id: pear-format-html.php,v 1.265 2008/03/30 21:58:50 dufuz Exp $
+ $Id: pear-format-html.php,v 1.266 2008/03/30 22:33:53 dufuz Exp $
*/
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'error_handler');
@@ -885,10 +885,23 @@
*
* @return string the time formatted time
*/
-function make_utc_date($ts = null, $format = 'Y-m-d H:i \U\T\C')
+function make_utc_date($ts = null, $format = 'Y-m-d H:i e')
+{
+ return format_date($ts, $format);
+}
+
+/**
+ * Turns a unix timestamp into a uniformly formatted date
+ * If the date is during the current year, the year is omitted.
+ *
+ * @param int $date the unix timestamp to be formatted
+ * @param string $format date function formatted string
+ * @return string the formatted date
+ */
+function format_date($ts = null, $format = 'Y-m-d H:i e')
{
if (!$ts) {
$ts = time();
}
- return gmdate($format, $ts);
+ return gmdate($format, $ts - date('Z', $ts));
}
\ No newline at end of file