diff --git a/en/appendices/new-features-in-cakephp-2-2.rst b/en/appendices/new-features-in-cakephp-2-2.rst index 3c6174e223..9123c129be 100644 --- a/en/appendices/new-features-in-cakephp-2-2.rst +++ b/en/appendices/new-features-in-cakephp-2-2.rst @@ -15,7 +15,7 @@ Models Pagination ========== -Paginating custom finders will now return correct counts, see Model changes for more info. +- Paginating custom finders will now return correct counts, see Model changes for more info. Utility ======= @@ -23,16 +23,20 @@ Utility CakeTime -------- -The ``$userOffset`` parameter has been replaced with ``$timezone`` parameter in all relevant functions. -So instead of numeric offset you can now pass in a timezone string or DateTimeZone object. -Passing numeric offsets for ``$timezone`` parameter is still possible for backwards compatibility. +- The ``$userOffset`` parameter has been replaced with ``$timezone`` parameter in all relevant functions. + So instead of numeric offset you can now pass in a timezone string or DateTimeZone object. + Passing numeric offsets for ``$timezone`` parameter is still possible for backwards compatibility. + +- New methods added: + :php:meth:`CakeTime::toServer()` + :php:meth:`CakeTime::timezone()` Configuration ============= -A new config parameter 'Config.timezone' is available which you can set to user's timezone string. -eg. You can do ``Configure::write('Config.timezone', 'Europe/Paris')``. -If a method of ``CakeTime`` class is called with ``$timezone`` parameter as null and 'Config.timezone' is set, then the -value of 'Config.timezone' will be used. This feature allows you to set user's timezone just once instead -of passing it each time in function calls. +- A new config parameter 'Config.timezone' is available which you can set to user's timezone string. + eg. You can do ``Configure::write('Config.timezone', 'Europe/Paris')``. + If a method of ``CakeTime`` class is called with ``$timezone`` parameter as null and 'Config.timezone' is set, + then thevalue of 'Config.timezone' will be used. This feature allows you to set user's timezone just once + instead of passing it each time in function calls. diff --git a/en/core-utility-libraries/time.rst b/en/core-utility-libraries/time.rst index d2d35bf5d9..41d675750a 100644 --- a/en/core-utility-libraries/time.rst +++ b/en/core-utility-libraries/time.rst @@ -302,6 +302,23 @@ Formatting A wrapper for fromString. +.. php:method:: toServer($dateString, $timezone = NULL, $format = 'Y-m-d H:i:s') + + :rtype: mixed + +.. versionadded:: 2.2 + + Returns a formatted date in server's timezone. + +.. php:method:: timezone($timezone = NULL) + + :rtype: DateTimeZone + +.. versionadded:: 2.2 + + Returns a timezone object from a string or the user's timezone object. If the function is called + without a parameter it tries to get timezone from 'Config.timezone' configuration variable. + Testing Time ============