Skip to content

Commit 9053949

Browse files
authored
Add timezone_select() usage
1 parent cf138b5 commit 9053949

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

user_guide_src/source/helpers/date_helper.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,21 @@ The following functions are available:
4343
If a timezone is not provided, it will return ``time()`` based on the
4444
**time_reference** setting.
4545

46+
.. php:function:: timezone_select([$class = '', $default = '', $what = \DateTimeZone::ALL, $country = null])
47+
48+
:param string $class: Optional class to apply to the select field
49+
:param string $default: Default value for initial selection
50+
:param string $what: DateTimeZone class constants (see `listIdentifiers <https://www.php.net/manual/en/datetimezone.listidentifiers.php>`_)
51+
:param string $country: A two-letter ISO 3166-1 compatible country code (see `listIdentifiers <https://www.php.net/manual/en/datetimezone.listidentifiers.php>`_)
52+
:returns: Preformatted HTML select field
53+
:rtype: string
54+
55+
Generates a `select` form field of available timezones (optionally filtered by `$what` and `$country`).
56+
You can supply an option class to apply to the field to make formatting easier, as well as a default
57+
selected value.
58+
::
59+
60+
echo timezone_select('custom-select', 'America/New_York');
61+
4662
Many functions previously found in the CodeIgniter 3 ``date_helper`` have been moved to the ``I18n``
4763
module in CodeIgniter 4.

0 commit comments

Comments
 (0)