From dba89a534120d48d0ba901aedd69f962536bf36d Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Wed, 7 Jul 2010 22:24:43 +0100 Subject: [PATCH] [feature/new-tz-handling] Added phpbb_datetime::__toString(). New phpbb_datetime::__toString() magic method that formats the datetime according to the users default settings. PHPBB3-9558 --- phpBB/includes/datetime.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/phpBB/includes/datetime.php b/phpBB/includes/datetime.php index 577081e40b..8763697c78 100644 --- a/phpBB/includes/datetime.php +++ b/phpBB/includes/datetime.php @@ -124,6 +124,16 @@ class phpbb_datetime extends DateTime return strtr(parent::format($format['format_long']), $format['lang']); } + /** + * Magic method to convert DateTime object to string + * + * @return Formatted date time, according to the users default settings. + */ + public function __toString() + { + return $this->format(); + } + /** * Pre-processes the specified date format *