aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@phpbb.com>2011-06-26 02:19:51 +0200
committerAndreas Fischer <bantu@phpbb.com>2011-07-12 23:46:20 +0200
commitdb352c17f8ce7e0abb06d6c71755ae2d9fd4c58d (patch)
tree769b9e3249330d278ac49685f670d47f2a561a9d
parente4707a8be75263e610b00b3d600144e797f576d9 (diff)
downloadforums-db352c17f8ce7e0abb06d6c71755ae2d9fd4c58d.tar
forums-db352c17f8ce7e0abb06d6c71755ae2d9fd4c58d.tar.gz
forums-db352c17f8ce7e0abb06d6c71755ae2d9fd4c58d.tar.bz2
forums-db352c17f8ce7e0abb06d6c71755ae2d9fd4c58d.tar.xz
forums-db352c17f8ce7e0abb06d6c71755ae2d9fd4c58d.zip
[ticket/10243] Adding wrapper function for getdate() for UTC timestamps.
PHPBB3-10243
-rw-r--r--phpBB/includes/functions.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index b1c1c14d0c..86eab4666f 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -266,6 +266,27 @@ function phpbb_mt_rand($min, $max)
}
/**
+* Wrapper for getdate() which returns the equivalent array for UTC timestamps.
+*
+* @param int $time Unix timestamp (optional)
+*
+* @return array Returns an associative array of information related to the timestamp.
+* See http://www.php.net/manual/en/function.getdate.php
+*/
+function phpbb_gmgetdate($time = false)
+{
+ if ($time === false)
+ {
+ $time = time();
+ }
+
+ // getdate() interprets timestamps in local time.
+ // What follows uses the fact that getdate() and
+ // date('Z') balance each other out.
+ return getdate($time - date('Z'));
+}
+
+/**
* Return formatted string for filesizes
*
* @param int $value filesize in bytes