|
IntlCalendar::clearClear a field or all fields DescriptionObject oriented style
public bool IntlCalendar::clear
([ int
$field = NULL
] )Procedural style
bool intlcal_clear
( IntlCalendar
$cal
[, int $field = NULL
] )Clears either all of the fields or a specific field. A cleared field is marked as unset, giving it the lowest priority against overlapping fields or even default values when calculating the time. Additionally, its value is set to 0, though given the fieldʼs low priority, its value may have been internally set to another value by the time the field has finished been queried. Parameters
Return Values
Returns Examples
Example #1 IntlCalendar::clear examples
<?phpThe above example will output:
After GregorianCalendar creation
Array
(
[0] => FIELD_ERA
[1] => FIELD_YEAR
[2] => FIELD_MONTH
[3] => FIELD_DATE
)
15/03/2013 00:00:00
After the formatter requested the extended year
Array
(
[0] => FIELD_ERA
[1] => FIELD_YEAR
[2] => FIELD_MONTH
[3] => FIELD_DATE
[4] => FIELD_EXTENDED_YEAR
)
After the year has been cleared, the date stays the same
15/03/2013 00:00:00
because FIELD_EXTENDED_YEAR is still set
Array
(
[0] => FIELD_ERA
[1] => FIELD_MONTH
[2] => FIELD_DATE
[3] => FIELD_EXTENDED_YEAR
)
bool(true)
After the extended year has been cleared
Array
(
[0] => FIELD_ERA
[1] => FIELD_MONTH
[2] => FIELD_DATE
)
15/03/1970 00:00:00
After the fields are recalculated,
extended year is set again (to 1970)
Array
(
[0] => FIELD_ERA
[1] => FIELD_MONTH
[2] => FIELD_DATE
[3] => FIELD_EXTENDED_YEAR
)
After calling variant with no arguments
Array
(
)
01/01/1970 00:00:00
|