From d9eae938e7b112ef9046de01eb6b46aa4ecfff54 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Wed, 12 Mar 2008 23:07:16 +0000 Subject: [PATCH] final part of DateFormatter docs git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@255017 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/intl/book.xml | 4 +- reference/intl/dateformatter/create.xml | 22 +++++--- reference/intl/dateformatter/format.xml | 17 +++--- reference/intl/dateformatter/get-calendar.xml | 20 ++++--- reference/intl/dateformatter/get-datetype.xml | 19 ++++--- .../intl/dateformatter/get-error-code.xml | 21 +++++--- .../intl/dateformatter/get-error-message.xml | 19 ++++--- reference/intl/dateformatter/get-locale.xml | 18 ++++--- reference/intl/dateformatter/get-pattern.xml | 20 ++++--- reference/intl/dateformatter/get-timetype.xml | 19 ++++--- .../intl/dateformatter/get-timezone-id.xml | 21 +++++--- reference/intl/dateformatter/is-lenient.xml | 50 ++++++++++++++--- reference/intl/dateformatter/localtime.xml | 53 +++++++++---------- reference/intl/dateformatter/parse.xml | 46 ++++++++-------- reference/intl/dateformatter/set-calendar.xml | 10 ++-- reference/intl/dateformatter/set-lenient.xml | 50 ++++++++++++++--- reference/intl/dateformatter/set-pattern.xml | 21 +++++--- .../intl/dateformatter/set-timezone-id.xml | 13 +++-- 18 files changed, 295 insertions(+), 148 deletions(-) diff --git a/reference/intl/book.xml b/reference/intl/book.xml index f073e78830..171a0c7eb9 100755 --- a/reference/intl/book.xml +++ b/reference/intl/book.xml @@ -1,5 +1,5 @@ - + Internationalization Functions @@ -229,7 +229,7 @@ echo $formatter->format(1234567); &reference.intl.locale; &reference.intl.normalizer; &reference.intl.messageformatter; - + &reference.intl.dateformatter; diff --git a/reference/intl/dateformatter/create.xml b/reference/intl/dateformatter/create.xml index b29b197c5f..a3a9510130 100644 --- a/reference/intl/dateformatter/create.xml +++ b/reference/intl/dateformatter/create.xml @@ -1,5 +1,5 @@ - + DateFormatter::create @@ -8,7 +8,9 @@ &reftitle.description; - Object oriented style + + Object oriented style + static DateFormatterDateFormatter::create @@ -19,7 +21,9 @@ integercalendar stringpattern - Object oriented style (constructor) + + Object oriented style (constructor) + DateFormatter::__construct @@ -32,7 +36,9 @@ stringpattern - Procedural style + + Procedural style + DateFormatterdatefmt_create stringlocale @@ -55,7 +61,7 @@ locale - Locale to use when formatting or parsing + Locale to use when formatting or parsing. @@ -83,7 +89,8 @@ timezone - Time zone ID, default is system default. + Time zone ID, default is system default. + @@ -100,7 +107,8 @@ pattern - Optional pattern to use when formatting or parsing + Optional pattern to use when formatting or parsing + diff --git a/reference/intl/dateformatter/format.xml b/reference/intl/dateformatter/format.xml index 8387440ea2..87843da3b2 100644 --- a/reference/intl/dateformatter/format.xml +++ b/reference/intl/dateformatter/format.xml @@ -1,5 +1,5 @@ - + DateFormatter::format @@ -8,7 +8,9 @@ &reftitle.description; - Object oriented style + + Object oriented style + DateFormatter @@ -16,7 +18,9 @@ mixedvalue - Procedural style + + Procedural style + stringdatefmt_format DateFormatterfmt @@ -35,7 +39,8 @@ fmt - The date formatter resource + The date formatter resource. + @@ -55,7 +60,8 @@ &reftitle.returnvalues; - The formatted string or, if an error occurred, &false;. + The formatted string or, if an error occurred, &false;. + @@ -65,7 +71,6 @@ - + DateFormatter::getCalendar datefmt_get_calendar - + Get the calendar used for the DateFormatter &reftitle.description; - Object oriented style + + Object oriented style + DateFormatter @@ -16,13 +18,15 @@ - Procedural style + + Procedural style + integerdatefmt_get_calendar DateFormatterfmt - + @@ -33,7 +37,8 @@ fmt - The formatter resource + The formatter resource + @@ -44,7 +49,8 @@ &reftitle.returnvalues; - The calendar being used by the formatter. + The calendar being used by the formatter. + diff --git a/reference/intl/dateformatter/get-datetype.xml b/reference/intl/dateformatter/get-datetype.xml index 05312da851..a60f7d57ef 100644 --- a/reference/intl/dateformatter/get-datetype.xml +++ b/reference/intl/dateformatter/get-datetype.xml @@ -1,14 +1,16 @@ - + DateFormatter::getDateType datefmt_get_datetype - + Get the datetype used for the DateFormatter &reftitle.description; - Object oriented style + + Object oriented style + DateFormatter @@ -16,14 +18,16 @@ - Procedural style + + Procedural style + integerdatefmt_get_datetype DateFormatterfmt - Returns date type used by the formatter. - + Returns date type used by the formatter. + @@ -34,7 +38,8 @@ fmt - The formatter resource. + The formatter resource. + diff --git a/reference/intl/dateformatter/get-error-code.xml b/reference/intl/dateformatter/get-error-code.xml index 88903b5e51..0e5c8e08fd 100644 --- a/reference/intl/dateformatter/get-error-code.xml +++ b/reference/intl/dateformatter/get-error-code.xml @@ -1,5 +1,5 @@ - + DateFormatter::getErrorCode @@ -8,7 +8,9 @@ &reftitle.description; - Object oriented style + + Object oriented style + DateFormatter @@ -16,14 +18,17 @@ - Procedural style + + Procedural style + integerdatefmt_get_error_code DateFormatterfmt - Get the error code from last operation -Returns error code from the last number formatting operation. + Get the error code from last operation. + Returns error code from the last number formatting operation. + @@ -34,7 +39,8 @@ Returns error code from the last number formatting operation. fmt - The formatter resource. + The formatter resource. + @@ -45,7 +51,8 @@ Returns error code from the last number formatting operation. &reftitle.returnvalues; - the error code, one of UErrorCode values. Initial value is U_ZERO_ERROR. + The error code, one of UErrorCode values. Initial value is U_ZERO_ERROR. + diff --git a/reference/intl/dateformatter/get-error-message.xml b/reference/intl/dateformatter/get-error-message.xml index 8a81183953..f3d17952c8 100644 --- a/reference/intl/dateformatter/get-error-message.xml +++ b/reference/intl/dateformatter/get-error-message.xml @@ -1,5 +1,5 @@ - + DateFormatter::getErrorMessage @@ -8,7 +8,9 @@ &reftitle.description; - Object oriented style + + Object oriented style + DateFormatter @@ -16,13 +18,16 @@ - Procedural style + + Procedural style + stringdatefmt_get_error_message DateFormatterfmt - Get the error text from the last operation. + Get the error text from the last operation. + @@ -33,7 +38,8 @@ fmt - The formatter resource. + The formatter resource. + @@ -44,7 +50,8 @@ &reftitle.returnvalues; - Description of the last error. + Description of the last error. + diff --git a/reference/intl/dateformatter/get-locale.xml b/reference/intl/dateformatter/get-locale.xml index 8c7674d0b1..dcb63c3017 100644 --- a/reference/intl/dateformatter/get-locale.xml +++ b/reference/intl/dateformatter/get-locale.xml @@ -1,5 +1,5 @@ - + DateFormatter::getLocale @@ -8,7 +8,9 @@ &reftitle.description; - Object oriented style + + Object oriented style + DateFormatter @@ -16,14 +18,16 @@ integerwhich - Procedural style + + Procedural style + stringdatefmt_get_locale DateFormatterfmt integerwhich - Get locale used by the formatter. + Get locale used by the formatter. @@ -35,7 +39,8 @@ fmt - The formatter resource + The formatter resource + @@ -57,7 +62,8 @@ &reftitle.returnvalues; - the locale of this formatter or 'false' if error + the locale of this formatter or 'false' if error + diff --git a/reference/intl/dateformatter/get-pattern.xml b/reference/intl/dateformatter/get-pattern.xml index 3a04d15cb0..5a236c41fe 100644 --- a/reference/intl/dateformatter/get-pattern.xml +++ b/reference/intl/dateformatter/get-pattern.xml @@ -1,14 +1,16 @@ - + DateFormatter::getPattern datefmt_get_pattern - + Get the pattern used for the DateFormatter &reftitle.description; - Object oriented style + + Object oriented style + DateFormatter @@ -16,13 +18,15 @@ - Procedural style + + Procedural style + stringdatefmt_get_pattern DateFormatterfmt - Get pattern used by the formatter. + Get pattern used by the formatter. @@ -34,7 +38,8 @@ fmt - The formatter resource. + The formatter resource. + @@ -45,7 +50,8 @@ &reftitle.returnvalues; - the pattern string being used to format/parse. + The pattern string being used to format/parse. + diff --git a/reference/intl/dateformatter/get-timetype.xml b/reference/intl/dateformatter/get-timetype.xml index 72ce7c032d..625ad5fc18 100644 --- a/reference/intl/dateformatter/get-timetype.xml +++ b/reference/intl/dateformatter/get-timetype.xml @@ -1,14 +1,16 @@ - + DateFormatter::getTimeType datefmt_get_timetype - + Get the timetype used for the DateFormatter &reftitle.description; - Object oriented style + + Object oriented style + DateFormatter @@ -16,14 +18,16 @@ - Procedural style + + Procedural style + integerdatefmt_get_timetype DateFormatterfmt - Return time type used by the formatter. - + Return time type used by the formatter. + @@ -34,7 +38,8 @@ fmt - The formatter resource. + The formatter resource. + diff --git a/reference/intl/dateformatter/get-timezone-id.xml b/reference/intl/dateformatter/get-timezone-id.xml index 13e51d47cd..016c4754ad 100644 --- a/reference/intl/dateformatter/get-timezone-id.xml +++ b/reference/intl/dateformatter/get-timezone-id.xml @@ -1,14 +1,16 @@ - + DateFormatter::getTimeZoneId datefmt_get_timezone_id - + Get the timezone-id used for the DateFormatter &reftitle.description; - Object oriented style + + Object oriented style + DateFormatter @@ -16,13 +18,16 @@ - Procedural style + + Procedural style + stringdatefmt_get_timezone_id DateFormatterfmt - + Get the timezone-id used for the DateFormatter. + @@ -33,7 +38,8 @@ fmt - The formatter resource. + The formatter resource. + @@ -44,7 +50,8 @@ &reftitle.returnvalues; - ID string for the time zone used by this formatter. + ID string for the time zone used by this formatter. + diff --git a/reference/intl/dateformatter/is-lenient.xml b/reference/intl/dateformatter/is-lenient.xml index baa5b37517..e3a0e3598c 100644 --- a/reference/intl/dateformatter/is-lenient.xml +++ b/reference/intl/dateformatter/is-lenient.xml @@ -1,14 +1,16 @@ - + DateFormatter::isLenient datefmt_is_lenient - + Get the lenient used for the DateFormatter &reftitle.description; - Object oriented style + + Object oriented style + DateFormatter @@ -16,7 +18,9 @@ - Procedural style + + Procedural style + booleandatefmt_is_lenient DateFormatterfmt @@ -34,7 +38,8 @@ fmt - The formatter resource + The formatter resource. + @@ -56,13 +61,20 @@ isLenient() ){ echo('TRUE'); }else{ echo('FALSE'); } +datefmt_parse($fmt,"35/13/1971"); +echo "\n Trying to do parse('35/13/1971').Result is : " .datefmt_parse($fmt,"35/13/1971"); +if( intl_get_error_code() !=0 ){ + echo "Error_msg is : ".intl_get_error_message(); + echo "Error_code is : ".intl_get_error_code(); +} datefmt_set_lenient($fmt,false); echo "Now lenient of the formatter is : "; if( $fmt->isLenient() ){ @@ -70,6 +82,12 @@ if( $fmt->isLenient() ){ }else{ echo('FALSE'); } +datefmt_parse($fmt,"35/13/1971"); +echo "\n Trying to do parse('35/13/1971').Result is : " .datefmt_parse($fmt,"35/13/1971"); +if( intl_get_error_code() !=0 ){ + echo "Error_msg is : ".intl_get_error_message(); + echo "Error_code is : ".intl_get_error_code(); +} ?> ]]> @@ -80,13 +98,21 @@ if( $fmt->isLenient() ){ isLenient() ){ echo('TRUE'); }else{ echo('FALSE'); } +$fmt->parse("35/13/1971"); +echo "\n Trying to do parse('35/13/1971').Result is : " .$fmt->parse("35/13/1971"); +if( intl_get_error_code() !=0 ){ + echo "Error_msg is : ".intl_get_error_message(); + echo "Error_code is : ".intl_get_error_code(); +} + $fmt->setLenient(FALSE); echo "Now lenient of the formatter is : "; if( $fmt->isLenient() ){ @@ -94,6 +120,12 @@ if( $fmt->isLenient() ){ }else{ echo('FALSE'); } +$fmt->parse("35/13/1971"); +echo "\n Trying to do parse('35/13/1971').Result is : " .$fmt->parse("35/13/1971"); +if( intl_get_error_code() !=0 ){ + echo "Error_msg is : ".intl_get_error_message(); + echo "Error_code is : ".intl_get_error_code(); +} ?> ]]> @@ -103,7 +135,11 @@ if( $fmt->isLenient() ){ diff --git a/reference/intl/dateformatter/localtime.xml b/reference/intl/dateformatter/localtime.xml index e136cfb6ce..a13a659b28 100644 --- a/reference/intl/dateformatter/localtime.xml +++ b/reference/intl/dateformatter/localtime.xml @@ -1,5 +1,5 @@ - + DateFormatter::localtime @@ -8,7 +8,9 @@ &reftitle.description; - Object oriented style + + Object oriented style + DateFormatter @@ -16,28 +18,22 @@ stringvalue arraylocaltime integerparse_pos - integererror - Procedural style + + Procedural style + arraydatefmt_localtime DateFormatterfmt stringvalue arraylocaltime integerparse_pos - integererror - converts string $value to a field-based time value, starting at -$parse_pos and consuming as much of the input value as possible -If no error occurs before $value is consumed, $parse_pos will contain -1 -otherwise it will contain the position at which parsing ended (and the error -occurred). $error will contain the error code. Note that this function -does not change the value in get_error(). -be overwritten! -This variable will contain the end position if the parse fails -If $parse_pos > strlen($value), the parse fails immediately. + Converts string $value to a field-based time value ( an array of various fields), starting at +$parse_pos and consuming as much of the input value as possible. + @@ -48,35 +44,35 @@ If $parse_pos > strlen($value), the parse fails immediately. fmt - The formatter resource + The formatter resource + value - string to convert to a time + string to convert to a time + localtime - the array to store the parsed value; values in this array will + The array to store the parsed value; values in this array will. + parse_pos - position at which to start the parsing in $value (zero-based) - - - - error - - - error value of any error that occurs during parsing + Position at which to start the parsing in $value (zero-based). + If no error occurs before $value is consumed, $parse_pos will contain -1 + otherwise it will contain the position at which parsing ended . + If $parse_pos > strlen($value), the parse fails immediately. + @@ -87,7 +83,8 @@ If $parse_pos > strlen($value), the parse fails immediately. &reftitle.returnvalues; - localtime compatible array of integers + Localtime compatible array of integers + @@ -99,7 +96,7 @@ If $parse_pos > strlen($value), the parse fails immediately. $value) { @@ -117,7 +114,7 @@ if ($arr) { localtime( "Wednesday, December 31, 1969 4:00:00 PM PT",0,0); +$arr = $fmt->localtime( "Wednesday, December 31, 1969 4:00:00 PM PT",0); echo "First parsed output is "; if ($arr) { foreach ($arr as $key => $value) { diff --git a/reference/intl/dateformatter/parse.xml b/reference/intl/dateformatter/parse.xml index a587044d88..af6ce62866 100644 --- a/reference/intl/dateformatter/parse.xml +++ b/reference/intl/dateformatter/parse.xml @@ -1,5 +1,5 @@ - + DateFormatter::parse @@ -8,33 +8,30 @@ &reftitle.description; - Object oriented style + + Object oriented style + DateFormatter integerparse stringvalue integerparse_pos - integererror - Procedural style + + Procedural style + integerdatefmt_parse DateFormatterfmt stringvalue integerparse_pos - integererror - converts string $value to an incremental time value, starting at -$parse_pos and consuming as much of the input value as possible -If no error occurs before $value is consumed, $parse_pos will contain -1 -otherwise it will contain the position at which parsing ended (and the error -occurred). $error will contain the error code. Note that this function -does not change the value in get_error(). -This variable will contain the end position if the parse fails -If $parse_pos > strlen($value), the parse fails immediately. + Converts string $value to an incremental time value, starting at + $parse_pos and consuming as much of the input value as possible. + @@ -45,28 +42,28 @@ If $parse_pos > strlen($value), the parse fails immediately. fmt - The formatter resource + The formatter resource + value - string to convert to a time + string to convert to a time + parse_pos - position at which to start the parsing in $value (zero-based) - - - - error - - - error value of any error that occurs during parsing + Position at which to start the parsing in $value (zero-based). + If no error occurs before $value is consumed, $parse_pos will contain -1 +otherwise it will contain the position at which parsing ended (and the error occurred). + This variable will contain the end position if the parse fails. + If $parse_pos > strlen($value), the parse fails immediately. + @@ -77,7 +74,8 @@ If $parse_pos > strlen($value), the parse fails immediately. &reftitle.returnvalues; - timestamp parsed value + timestamp parsed value + diff --git a/reference/intl/dateformatter/set-calendar.xml b/reference/intl/dateformatter/set-calendar.xml index c5d800aa99..a3641a7ee4 100644 --- a/reference/intl/dateformatter/set-calendar.xml +++ b/reference/intl/dateformatter/set-calendar.xml @@ -1,5 +1,5 @@ - + DateFormatter::setCalendar @@ -8,7 +8,9 @@ &reftitle.description; - Object oriented style + + Object oriented style + DateFormatter @@ -16,7 +18,9 @@ integerwhich - Procedural style + + Procedural style + booleandatefmt_set_calendar DateFormatterfmt diff --git a/reference/intl/dateformatter/set-lenient.xml b/reference/intl/dateformatter/set-lenient.xml index fa6c4fd72b..cb1e98f706 100644 --- a/reference/intl/dateformatter/set-lenient.xml +++ b/reference/intl/dateformatter/set-lenient.xml @@ -1,5 +1,5 @@ - + DateFormatter::setLenient @@ -8,7 +8,9 @@ &reftitle.description; - Object oriented style + + Object oriented style + DateFormatter @@ -16,7 +18,9 @@ booleanlenient - Procedural style + + Procedural style + booleandatefmt_set_lenient DateFormatterfmt @@ -38,7 +42,8 @@ fmt - The formatter resource + The formatter resource + @@ -68,13 +73,20 @@ isLenient() ){ echo('TRUE'); }else{ echo('FALSE'); } +datefmt_parse($fmt,"35/13/1971"); +echo "\n Trying to do parse('35/13/1971').Result is : " .datefmt_parse($fmt,"35/13/1971"); +if( intl_get_error_code() !=0 ){ + echo "Error_msg is : ".intl_get_error_message(); + echo "Error_code is : ".intl_get_error_code(); +} datefmt_set_lenient($fmt,false); echo "Now lenient of the formatter is : "; if( $fmt->isLenient() ){ @@ -82,6 +94,12 @@ if( $fmt->isLenient() ){ }else{ echo('FALSE'); } +datefmt_parse($fmt,"35/13/1971"); +echo "\n Trying to do parse('35/13/1971').Result is : " .datefmt_parse($fmt,"35/13/1971"); +if( intl_get_error_code() !=0 ){ + echo "Error_msg is : ".intl_get_error_message(); + echo "Error_code is : ".intl_get_error_code(); +} ?> ]]> @@ -92,13 +110,21 @@ if( $fmt->isLenient() ){ isLenient() ){ echo('TRUE'); }else{ echo('FALSE'); } +$fmt->parse("35/13/1971"); +echo "\n Trying to do parse('35/13/1971').Result is : " .$fmt->parse("35/13/1971"); +if( intl_get_error_code() !=0 ){ + echo "Error_msg is : ".intl_get_error_message(); + echo "Error_code is : ".intl_get_error_code(); +} + $fmt->setLenient(FALSE); echo "Now lenient of the formatter is : "; if( $fmt->isLenient() ){ @@ -106,6 +132,13 @@ if( $fmt->isLenient() ){ }else{ echo('FALSE'); } +$fmt->parse("35/13/1971"); +echo "\n Trying to do parse('35/13/1971').Result is : " .$fmt->parse("35/13/1971"); +if( intl_get_error_code() !=0 ){ + echo "Error_msg is : ".intl_get_error_message(); + echo "Error_code is : ".intl_get_error_code(); +} + ?> ]]> @@ -114,7 +147,12 @@ if( $fmt->isLenient() ){ diff --git a/reference/intl/dateformatter/set-pattern.xml b/reference/intl/dateformatter/set-pattern.xml index b8e75ba2c1..f38d0883b0 100644 --- a/reference/intl/dateformatter/set-pattern.xml +++ b/reference/intl/dateformatter/set-pattern.xml @@ -1,14 +1,16 @@ - + DateFormatter::setPattern datefmt_set_pattern - + Set the pattern used for the DateFormatter &reftitle.description; - Object oriented style + + Object oriented style + DateFormatter @@ -16,14 +18,17 @@ stringpattern - Procedural style + + Procedural style + booleandatefmt_set_pattern DateFormatterfmt stringpattern - + Set the pattern used for the DateFormatter. + @@ -34,14 +39,16 @@ fmt - The formatter resource + The formatter resource. + pattern - new pattern string to use + New pattern string to use. + diff --git a/reference/intl/dateformatter/set-timezone-id.xml b/reference/intl/dateformatter/set-timezone-id.xml index 43f882f29d..d5a5c84500 100644 --- a/reference/intl/dateformatter/set-timezone-id.xml +++ b/reference/intl/dateformatter/set-timezone-id.xml @@ -1,5 +1,5 @@ - + DateFormatter::setTimeZoneId @@ -8,7 +8,9 @@ &reftitle.description; - Object oriented style + + Object oriented style + DateFormatter @@ -16,7 +18,9 @@ stringzone - Procedural style + + Procedural style + booleandatefmt_set_timezone_id DateFormatterfmt @@ -35,7 +39,8 @@ fmt - The formatter resource. + The formatter resource. +