mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 21:58:52 +00:00
[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:
parent
6a783b843b
commit
74be23a098
1 changed files with 15 additions and 0 deletions
|
@ -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
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue