aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Smith <toonarmy@phpbb.com>2010-07-07 22:20:08 +0100
committerOleg Pudeyev <oleg@bsdpower.com>2012-03-14 22:57:29 -0400
commit74be23a098ec222cf3f3d14d6b6df236c58e8c01 (patch)
tree8788d9a77f29e085e08807b041017d31f1d83b79
parent6a783b843b596c46738d76f2db5d539d8f68a815 (diff)
downloadforums-74be23a098ec222cf3f3d14d6b6df236c58e8c01.tar
forums-74be23a098ec222cf3f3d14d6b6df236c58e8c01.tar.gz
forums-74be23a098ec222cf3f3d14d6b6df236c58e8c01.tar.bz2
forums-74be23a098ec222cf3f3d14d6b6df236c58e8c01.tar.xz
forums-74be23a098ec222cf3f3d14d6b6df236c58e8c01.zip
[feature/new-tz-handling] Added a user::create_datetime() method.
New method which handles instantiating new phpbb_datetime objects in the context of the current user. PHPBB3-9558
-rw-r--r--phpBB/includes/session.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php
index 2352e6394a..e91606878a 100644
--- a/phpBB/includes/session.php
+++ b/phpBB/includes/session.php
@@ -2106,6 +2106,21 @@ class user extends session
}
/**
+ * Create a phpbb_datetime object in the context of the current user
+ *
+ * @since 3.1
+ * @param string $time String in a format accepted by strtotime().
+ * @param DateTimeZone $timezone Time zone of the time.
+ * @return phpbb_datetime Date time object linked to the current users locale
+ */
+ public function create_datetime($time, DateTimeZone $timezone = null)
+ {
+ $timezone = $timezone ? $timezone : $this->tz;
+
+ return new phpbb_datetime($time, $timezone, $this);
+ }
+
+ /**
* Get language id currently used by the user
*/
function get_iso_lang_id()