[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
This commit is contained in:
Chris Smith 2010-07-07 22:20:08 +01:00 committed by Oleg Pudeyev
parent 6a783b843b
commit 74be23a098

View file

@ -2105,6 +2105,21 @@ class user extends session
return $time->format($format, $forcedate);
}
/**
* 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
*/