|
2 | 2 | Times and Dates
|
3 | 3 | ###############
|
4 | 4 |
|
5 |
| -CodeIgniter provides a fully-localized, immutable, date/time class that is built on PHP's DateTime object, but uses the Intl |
| 5 | +CodeIgniter provides a fully-localized, immutable, date/time class that is built on PHP's DateTimeImmutable object, but uses the Intl |
6 | 6 | extension's features to convert times across timezones and display the output correctly for different locales. This class
|
7 | 7 | is the ``Time`` class and lives in the ``CodeIgniter\I18n`` namespace.
|
8 | 8 |
|
9 |
| -.. note:: Since the Time class extends DateTime, if there are features that you need that this class doesn't provide, |
10 |
| - you can likely find them within the `DateTime <https://www.php.net/manual/en/class.datetime.php>`_ class itself. |
| 9 | +.. note:: Since the Time class extends DateTimeImmutable, if there are features that you need that this class doesn't provide, |
| 10 | + you can likely find them within the `DateTime <https://www.php.net/manual/en/class.datetimeimmutable.php>`_ class itself. |
11 | 11 |
|
12 | 12 | .. contents::
|
13 | 13 | :local:
|
@@ -42,7 +42,7 @@ in the second and parameters, respectively. If no locale or timezone is provided
|
42 | 42 | parse()
|
43 | 43 | =======
|
44 | 44 |
|
45 |
| -This helper method is a static version of the default constructor. It takes a string acceptable as DateTime's |
| 45 | +This helper method is a static version of the default constructor. It takes a string acceptable as DateTimeImmutable's |
46 | 46 | constructor as the first parameter, a timezone as the second parameter, and the locale as the third parameter:
|
47 | 47 |
|
48 | 48 | .. literalinclude:: time/004.php
|
@@ -101,8 +101,8 @@ timezone and locale in the fourth and fifth parameters:
|
101 | 101 | createFromFormat()
|
102 | 102 | ==================
|
103 | 103 |
|
104 |
| -This is a replacement for DateTime's method of the same name. This allows the timezone to be set at the same time, |
105 |
| -and returns a ``Time`` instance, instead of DateTime: |
| 104 | +This is a replacement for DateTimeImmutable's method of the same name. This allows the timezone to be set at the same time, |
| 105 | +and returns a ``Time`` instance, instead of DateTimeImmutable: |
106 | 106 |
|
107 | 107 | .. literalinclude:: time/011.php
|
108 | 108 |
|
@@ -136,14 +136,14 @@ not aware of locales:
|
136 | 136 | Displaying the Value
|
137 | 137 | ********************
|
138 | 138 |
|
139 |
| -Since the Time class extends DateTime, you get all of the output methods that provides, including the ``format()`` method. |
140 |
| -However, the DateTime methods do not provide a localized result. The Time class does provide a number of helper methods |
| 139 | +Since the Time class extends DateTimeImmutable, you get all of the output methods that provides, including the ``format()`` method. |
| 140 | +However, the DateTimeImmutable methods do not provide a localized result. The Time class does provide a number of helper methods |
141 | 141 | to display localized versions of the value, though.
|
142 | 142 |
|
143 | 143 | toLocalizedString()
|
144 | 144 | ===================
|
145 | 145 |
|
146 |
| -This is the localized version of DateTime's ``format()`` method. Instead of using the values you might be familiar with, though, |
| 146 | +This is the localized version of DateTimeImmutable's ``format()`` method. Instead of using the values you might be familiar with, though, |
147 | 147 | you must use values acceptable to the `IntlDateFormatter <https://www.php.net/manual/en/class.intldateformatter.php>`__ class.
|
148 | 148 | A full listing of values can be found `here <https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/classSimpleDateFormat.html#details>`__.
|
149 | 149 |
|
|
0 commit comments