diff --git a/reference/intl/dateformatter/format.xml b/reference/intl/dateformatter/format.xml
index 09b76abdf2..651b2058b3 100644
--- a/reference/intl/dateformatter/format.xml
+++ b/reference/intl/dateformatter/format.xml
@@ -112,15 +112,43 @@
]]>
@@ -130,15 +158,43 @@ echo "Second Formatted output with pattern is ".datefmt_format( $fmt , 0);
format(0);
-$fmt = new IntlDateFormatter( "de-DE" ,IntlDateFormatter::FULL,IntlDateFormatter::FULL,'America/Los_Angeles',IntlDateFormatter::GREGORIAN );
-echo "Second Formatted output is ".$fmt->format(0);
+$fmt = new IntlDateFormatter(
+ 'en_US',
+ IntlDateFormatter::FULL,
+ IntlDateFormatter::FULL,
+ 'America/Los_Angeles',
+ IntlDateFormatter::GREGORIAN
+);
+echo 'First Formatted output is ' . $fmt->format(0);
-$fmt = new IntlDateFormatter( "en_US" ,IntlDateFormatter::FULL,IntlDateFormatter::FULL,'America/Los_Angeles',IntlDateFormatter::GREGORIAN ,"MM/dd/yyyy");
-echo "First Formatted output with pattern is ".$fmt->format(0);
-$fmt = new IntlDateFormatter( "de-DE" ,IntlDateFormatter::FULL,IntlDateFormatter::FULL,'America/Los_Angeles',IntlDateFormatter::GREGORIAN , "MM/dd/yyyy");
-echo "Second Formatted output with pattern is ".$fmt->format(0);
+$fmt = new IntlDateFormatter(
+ 'de-DE',
+ IntlDateFormatter::FULL,
+ IntlDateFormatter::FULL,
+ 'America/Los_Angeles',
+ IntlDateFormatter::GREGORIAN
+);
+echo 'Second Formatted output is ' . $fmt->format(0);
+
+$fmt = new IntlDateFormatter(
+ 'en_US',
+ IntlDateFormatter::FULL,
+ IntlDateFormatter::FULL,
+ 'America/Los_Angeles',
+ IntlDateFormatter::GREGORIAN,
+ 'MM/dd/yyyy'
+);
+echo 'First Formatted output with pattern is ' . $fmt->format(0);
+
+$fmt = new IntlDateFormatter(
+ 'de-DE',
+ IntlDateFormatter::FULL,
+ IntlDateFormatter::FULL,
+ 'America/Los_Angeles',
+ IntlDateFormatter::GREGORIAN,
+ 'MM/dd/yyyy'
+);
+echo 'Second Formatted output with pattern is ' . $fmt->format(0);
?>
]]>
@@ -158,14 +214,14 @@ Second Formatted output with pattern is 12/31/1969
set(IntlCalendar::FIELD_MONTH, 8); //9th month, Ramadan
@@ -189,9 +245,9 @@ echo "After changing timezone:\n\t",
diff --git a/reference/intl/dateformatter/get-calendar.xml b/reference/intl/dateformatter/get-calendar.xml
index 1ac1179565..f01b903367 100644
--- a/reference/intl/dateformatter/get-calendar.xml
+++ b/reference/intl/dateformatter/get-calendar.xml
@@ -60,10 +60,16 @@
]]>
@@ -73,10 +79,16 @@ echo "Now calendar of the formatter is : ".datefmt_get_calendar($fmt);
getCalendar();
+$fmt = new IntlDateFormatter(
+ 'en_US',
+ IntlDateFormatter::FULL,
+ IntlDateFormatter::FULL,
+ 'America/Los_Angeles',
+ IntlDateFormatter::GREGORIAN
+);
+echo 'calendar of the formatter is : ' . $fmt->getCalendar();
$fmt->setCalendar(IntlDateFormatter::TRADITIONAL);
-echo "Now calendar of the formatter is : ".$fmt->getCalendar();
+echo 'Now calendar of the formatter is : ' . $fmt->getCalendar();
?>
]]>
diff --git a/reference/intl/dateformatter/get-datetype.xml b/reference/intl/dateformatter/get-datetype.xml
index b64644b296..1488c1edcf 100644
--- a/reference/intl/dateformatter/get-datetype.xml
+++ b/reference/intl/dateformatter/get-datetype.xml
@@ -58,12 +58,25 @@
]]>
@@ -74,12 +87,24 @@ echo "Second Formatted output with datetype is ".datefmt_format( $fmt , 0);
getDateType();
-echo "First Formatted output is ".datefmt_format( $fmt , 0);
-$fmt = new IntlDateFormatter( "en_US" ,IntlDateFormatter::SHORT,IntlDateFormatter::FULL,'America/Los_Angeles',IntlDateFormatter::GREGORIAN);
-echo "Now datetype of the formatter is : ".$fmt->getDateType();
-echo "Second Formatted output is ".datefmt_format( $fmt , 0);
+$fmt = new IntlDateFormatter(
+ 'en_US',
+ IntlDateFormatter::FULL,
+ IntlDateFormatter::FULL,
+ 'America/Los_Angeles',
+ IntlDateFormatter::GREGORIAN
+);
+echo 'datetype of the formatter is : ' . $fmt->getDateType();
+echo 'First Formatted output is ' . $fmt->format(0);
+$fmt = new IntlDateFormatter(
+ 'en_US',
+ IntlDateFormatter::SHORT,
+ IntlDateFormatter::FULL,
+ 'America/Los_Angeles',
+ IntlDateFormatter::GREGORIAN
+);
+echo 'Now datetype of the formatter is : ' . $fmt->getDateType();
+echo 'Second Formatted output is ' . $fmt->format(0);
?>
]]>
diff --git a/reference/intl/dateformatter/get-error-code.xml b/reference/intl/dateformatter/get-error-code.xml
index ecd45ec5d5..9e3b397532 100644
--- a/reference/intl/dateformatter/get-error-code.xml
+++ b/reference/intl/dateformatter/get-error-code.xml
@@ -59,10 +59,20 @@
]]>
@@ -73,10 +83,20 @@ if(!$str) {
format();
-if(!$str) {
- echo "ERROR: ".$fmt->getErrorMessage() . " (" . $fmt->getErrorCode() . ")\n";
+if (!$str) {
+ printf(
+ "ERROR: %s (%d)\n",
+ $fmt->getErrorMessage(),
+ $fmt->getErrorCode()
+ );
}
?>
]]>
diff --git a/reference/intl/dateformatter/get-error-message.xml b/reference/intl/dateformatter/get-error-message.xml
index 6932d31487..95c8affb3e 100644
--- a/reference/intl/dateformatter/get-error-message.xml
+++ b/reference/intl/dateformatter/get-error-message.xml
@@ -58,10 +58,20 @@
]]>
@@ -72,10 +82,20 @@ if(!$str) {
format();
if(!$str) {
- echo "ERROR: ".$fmt->getErrorMessage() . " (" . $fmt->getErrorCode() . ")\n";
+ prtinf(
+ "ERROR: %s (%d)\n",
+ $fmt->getErrorMessage(),
+ $fmt->getErrorCode()
+ );
}
?>
diff --git a/reference/intl/dateformatter/get-locale.xml b/reference/intl/dateformatter/get-locale.xml
index e99ff5e4b0..a52295de44 100644
--- a/reference/intl/dateformatter/get-locale.xml
+++ b/reference/intl/dateformatter/get-locale.xml
@@ -70,12 +70,25 @@
]]>
@@ -86,12 +99,25 @@ echo "Second Formatted output is ".datefmt_format( $fmt , 0);
getLocale();
-echo "First Formatted output is ".$fmt->format(0);
-$fmt = new IntlDateFormatter( "de-DE" ,IntlDateFormatter::FULL,IntlDateFormatter::FULL,'America/Los_Angeles',IntlDateFormatter::GREGORIAN );
-echo "locale of the formatter is : ".$fmt->getLocale();
-echo "Second Formatted output is ".$fmt->format(0);
+$fmt = new IntlDateFormatter(
+ 'en_US',
+ IntlDateFormatter::FULL,
+ IntlDateFormatter::FULL,
+ 'America/Los_Angeles',
+ IntlDateFormatter::GREGORIAN
+);
+echo 'locale of the formatter is : ' . $fmt->getLocale();
+echo 'First Formatted output is ' . $fmt->format(0);
+
+$fmt = new IntlDateFormatter(
+ 'de-DE',
+ IntlDateFormatter::FULL,
+ IntlDateFormatter::FULL,
+ 'America/Los_Angeles',
+ IntlDateFormatter::GREGORIAN
+);
+echo 'locale of the formatter is : ' . $fmt->getLocale();
+echo 'Second Formatted output is ' . $fmt->format(0);
?>
]]>
diff --git a/reference/intl/dateformatter/get-pattern.xml b/reference/intl/dateformatter/get-pattern.xml
index 0f73797cb1..6e948fba92 100644
--- a/reference/intl/dateformatter/get-pattern.xml
+++ b/reference/intl/dateformatter/get-pattern.xml
@@ -58,12 +58,19 @@
]]>
@@ -74,12 +81,19 @@ echo "Second Formatted output with pattern is ".datefmt_format( $fmt , 0);
getPattern();
-echo "First Formatted output is ".datefmt_format( $fmt , 0);
+$fmt = new IntlDateFormatter(
+ 'en_US',
+ IntlDateFormatter::FULL,
+ IntlDateFormatter::FULL,
+ 'America/Los_Angeles',
+ IntlDateFormatter::GREGORIAN,
+ 'MM/dd/yyyy'
+);
+echo 'pattern of the formatter is : ' . $fmt->getPattern();
+echo 'First Formatted output is ' . $fmt->format(0);
$fmt->setPattern('yyyymmdd hh:mm:ss z');
-echo "Now pattern of the formatter is : ".$fmt->getPattern();
-echo "Second Formatted output is ".datefmt_format( $fmt , 0);
+echo 'Now pattern of the formatter is : ' . $fmt->getPattern();
+echo 'Second Formatted output is ' . $fmt->format(0);
?>
]]>
diff --git a/reference/intl/dateformatter/get-timetype.xml b/reference/intl/dateformatter/get-timetype.xml
index e20f46a201..e72c903542 100644
--- a/reference/intl/dateformatter/get-timetype.xml
+++ b/reference/intl/dateformatter/get-timetype.xml
@@ -58,12 +58,25 @@
]]>
@@ -74,12 +87,25 @@ echo "Second Formatted output with timetype is ".datefmt_format( $fmt , 0);
getTimeType();
-echo "First Formatted output is ".datefmt_format( $fmt , 0);
-$fmt = new IntlDateFormatter( "en_US" ,IntlDateFormatter::FULL,IntlDateFormatter::SHORT,'America/Los_Angeles',IntlDateFormatter::GREGORIAN);
-echo "Now timetype of the formatter is : ".$fmt->getTimeType();
-echo "Second Formatted output is ".datefmt_format( $fmt , 0);
+$fmt = new IntlDateFormatter(
+ 'en_US',
+ IntlDateFormatter::FULL,
+ IntlDateFormatter::FULL,
+ 'America/Los_Angeles',
+ IntlDateFormatter::GREGORIAN
+);
+echo 'timetype of the formatter is : ' . $fmt->getTimeType();
+echo 'First Formatted output is ' . $fmt->format(0);
+
+$fmt = new IntlDateFormatter(
+ 'en_US',
+ IntlDateFormatter::FULL,
+ IntlDateFormatter::SHORT,
+ 'America/Los_Angeles',
+ IntlDateFormatter::GREGORIAN
+);
+echo 'Now timetype of the formatter is : ' . $fmt->getTimeType();
+echo 'Second Formatted output is ' . $fmt->format(0);
?>
]]>
diff --git a/reference/intl/dateformatter/get-timezone-id.xml b/reference/intl/dateformatter/get-timezone-id.xml
index fe13b8eb2d..f73c0ba1de 100644
--- a/reference/intl/dateformatter/get-timezone-id.xml
+++ b/reference/intl/dateformatter/get-timezone-id.xml
@@ -58,10 +58,16 @@
]]>
@@ -72,10 +78,16 @@ echo "Now timezone_id of the formatter is : ".datefmt_get_timezone_id($fmt);
getTimezoneId();
+$fmt = new IntlDateFormatter(
+ 'en_US',
+ IntlDateFormatter::FULL,
+ IntlDateFormatter::FULL,
+ 'America/Los_Angeles',
+ IntlDateFormatter::GREGORIAN
+);
+echo 'timezone_id of the formatter is : ' . $fmt->getTimezoneId();
$fmt->setTimezoneId('CN');
-echo "Now timezone_id of the formatter is : ".$fmt->getTimezoneId();
+echo 'Now timezone_id of the formatter is : ' . $fmt->getTimezoneId();
?>
]]>
diff --git a/reference/intl/dateformatter/getcalendarobject.xml b/reference/intl/dateformatter/getcalendarobject.xml
index 2de9a0c559..a522a4b909 100644
--- a/reference/intl/dateformatter/getcalendarobject.xml
+++ b/reference/intl/dateformatter/getcalendarobject.xml
@@ -58,14 +58,21 @@
getCalendarObject();
-var_dump($cal->getType(),
- $cal->getTimeZone(),
- $cal->getLocale(Locale::VALID_LOCALE));
+var_dump(
+ $cal->getType(),
+ $cal->getTimeZone(),
+ $cal->getLocale(Locale::VALID_LOCALE)
+);
]]>
diff --git a/reference/intl/dateformatter/is-lenient.xml b/reference/intl/dateformatter/is-lenient.xml
index 0757bb7e56..b856eb487c 100644
--- a/reference/intl/dateformatter/is-lenient.xml
+++ b/reference/intl/dateformatter/is-lenient.xml
@@ -58,31 +58,38 @@
isLenient() ){
- echo('TRUE');
-}else{
- echo('FALSE');
+$fmt = datefmt_create(
+ 'en_US',
+ IntlDateFormatter::FULL,
+ IntlDateFormatter::FULL,
+ 'America/Los_Angeles',
+ IntlDateFormatter::GREGORIAN,
+ 'dd/mm/yyyy'
+);
+echo 'lenient of the formatter is : ';
+if ($fmt->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_parse($fmt, '35/13/1971');
+echo "\n Trying to do parse('35/13/1971').\nResult is : " . datefmt_parse($fmt, '35/13/1971');
+if (intl_get_error_code() != 0) {
+ echo "\nError_msg is : " . intl_get_error_message();
+ echo "\nError_code is : " . intl_get_error_code();
}
datefmt_set_lenient($fmt,false);
-echo "Now lenient of the formatter is : ";
-if( $fmt->isLenient() ){
- echo('TRUE');
-}else{
- echo('FALSE');
+echo 'Now lenient of the formatter is : ';
+if ($fmt->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_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 "\nError_msg is : " . intl_get_error_message();
+ echo "\nError_code is : " . intl_get_error_code();
}
?>
@@ -94,32 +101,39 @@ if( intl_get_error_code() !=0 ){
isLenient() ){
- echo('TRUE');
-}else{
- echo('FALSE');
+if ($fmt->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->parse('35/13/1971');
+echo "\n Trying to do parse('35/13/1971').\nResult is : " . $fmt->parse('35/13/1971');
+if (intl_get_error_code() != 0){
+ echo "\nError_msg is : " . intl_get_error_message();
+ echo "\nError_code is : " . intl_get_error_code();
}
$fmt->setLenient(FALSE);
-echo "Now lenient of the formatter is : ";
-if( $fmt->isLenient() ){
- echo('TRUE');
-}else{
- echo('FALSE');
+echo 'Now lenient of the formatter is : ';
+if ($fmt->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->parse('35/13/1971');
+echo "\n Trying to do parse('35/13/1971').\nResult is : " . $fmt->parse('35/13/1971');
+if (intl_get_error_code() != 0) {
+ echo "\nError_msg is : " . intl_get_error_message();
+ echo "\nError_code is : " . intl_get_error_code();
}
?>
@@ -134,7 +148,9 @@ Trying to do parse('35/13/1971').
Result is : -2147483
Now lenient of the formatter is : FALSE
Trying to do parse('35/13/1971').
-Result is : Error_msg is : Date parsing failed: U_PARSE_ERROR Error_code is : 9
+Result is :
+Error_msg is : Date parsing failed: U_PARSE_ERROR
+Error_code is : 9
]]>
diff --git a/reference/intl/dateformatter/localtime.xml b/reference/intl/dateformatter/localtime.xml
index dac56e0213..11c31cb61f 100644
--- a/reference/intl/dateformatter/localtime.xml
+++ b/reference/intl/dateformatter/localtime.xml
@@ -82,9 +82,15 @@ $parse_pos and consuming as much of the input value as possible.
$value) {
echo "$key : $value , ";
@@ -100,9 +106,15 @@ if ($arr) {
localtime( "Wednesday, December 31, 1969 4:00:00 PM PT",0);
-echo "First parsed output is ";
+$fmt = new IntlDateFormatter(
+ 'en_US',
+ IntlDateFormatter::FULL,
+ IntlDateFormatter::FULL,
+ 'America/Los_Angeles',
+ IntlDateFormatter::GREGORIAN
+);
+$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) {
echo "$key : $value , ";
diff --git a/reference/intl/dateformatter/parse.xml b/reference/intl/dateformatter/parse.xml
index 9ce919bd09..bc9fd7339e 100644
--- a/reference/intl/dateformatter/parse.xml
+++ b/reference/intl/dateformatter/parse.xml
@@ -82,10 +82,21 @@
parse("Wednesday, December 20, 1989 4:00:00 PM PT");
-$fmt = new IntlDateFormatter( "de-DE" ,IntlDateFormatter::FULL,IntlDateFormatter::FULL,'America/Los_Angeles',IntlDateFormatter::GREGORIAN );
-echo "Second parsed output is ".$fmt->parse("Mittwoch, 20. Dezember 1989 16:00 Uhr GMT-08:00");
+$fmt = new IntlDateFormatter(
+ 'en_US',
+ IntlDateFormatter::FULL,
+ IntlDateFormatter::FULL,
+ 'America/Los_Angeles',
+ IntlDateFormatter::GREGORIAN
+);
+echo 'First parsed output is ' . $fmt->parse('Wednesday, December 20, 1989 4:00:00 PM PT');
+$fmt = new IntlDateFormatter(
+ 'de-DE',
+ IntlDateFormatter::FULL,
+ IntlDateFormatter::FULL,
+ 'America/Los_Angeles',
+ IntlDateFormatter::GREGORIAN
+);
?>
]]>
@@ -95,11 +106,23 @@ echo "Second parsed output is ".$fmt->parse("Mittwoch, 20. Dezember 1989 16:00 U
+$fmt = datefmt_create(
+ 'en_US',
+ IntlDateFormatter::FULL,
+ IntlDateFormatter::FULL,
+ 'America/Los_Angeles',
+ IntlDateFormatter::GREGORIAN
+);
+echo 'First parsed output is ' . datefmt_parse($fmt, 'Wednesday, December 20, 1989 4:00:00 PM PT');
+$fmt = datefmt_create(
+ 'de-DE',
+ IntlDateFormatter::FULL,
+ IntlDateFormatter::FULL,
+ 'America/Los_Angeles',
+ IntlDateFormatter::GREGORIAN
+);
+echo 'Second parsed output is ' . datefmt_parse($fmt, 'Mittwoch, 20. Dezember 1989 16:00 Uhr GMT-08:00');
+?
]]>
diff --git a/reference/intl/dateformatter/set-calendar.xml b/reference/intl/dateformatter/set-calendar.xml
index 8c02f046fd..fb94da4613 100644
--- a/reference/intl/dateformatter/set-calendar.xml
+++ b/reference/intl/dateformatter/set-calendar.xml
@@ -106,10 +106,16 @@
]]>
@@ -119,10 +125,16 @@ echo "Now calendar of the formatter is : ".datefmt_get_calendar($fmt);
getCalendar();
+$fmt = new IntlDateFormatter(
+ 'en_US',
+ IntlDateFormatter::FULL,
+ IntlDateFormatter::FULL,
+ 'America/Los_Angeles',
+ IntlDateFormatter::GREGORIAN
+);
+echo 'calendar of the formatter is : ' . $fmt->getCalendar();
$fmt->setCalendar(IntlDateFormatter::TRADITIONAL);
-echo "Now calendar of the formatter is : ".$fmt->getCalendar();
+echo 'Now calendar of the formatter is : ' . $fmt->getCalendar();
?>
]]>
diff --git a/reference/intl/dateformatter/set-lenient.xml b/reference/intl/dateformatter/set-lenient.xml
index 725e09d65d..35083d1d37 100644
--- a/reference/intl/dateformatter/set-lenient.xml
+++ b/reference/intl/dateformatter/set-lenient.xml
@@ -70,31 +70,38 @@
isLenient() ){
- echo('TRUE');
-}else{
- echo('FALSE');
+$fmt = datefmt_create(
+ 'en_US',
+ IntlDateFormatter::FULL,
+ IntlDateFormatter::FULL,
+ 'America/Los_Angeles',
+ IntlDateFormatter::GREGORIAN,
+ 'dd/mm/yyyy'
+);
+echo 'lenient of the formatter is : ';
+if ($fmt->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_parse($fmt, '35/13/1971');
+echo "\n Trying to do parse('35/13/1971').\nResult is : " . datefmt_parse($fmt, '35/13/1971');
+if (intl_get_error_code() != 0) {
+ echo "\nError_msg is : " . intl_get_error_message();
+ echo "\nError_code is : " . intl_get_error_code();
}
-datefmt_set_lenient($fmt,false);
-echo "Now lenient of the formatter is : ";
-if( $fmt->isLenient() ){
- echo('TRUE');
-}else{
- echo('FALSE');
+datefmt_set_lenient($fmt, false);
+echo 'Now lenient of the formatter is : ';
+if ($fmt->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_parse($fmt, '35/13/1971');
+echo "\nTrying to do parse('35/13/1971').\nResult is : " . datefmt_parse($fmt, '35/13/1971');
+if (intl_get_error_code() != 0) {
+ echo "\nError_msg is : ".intl_get_error_message();
+ echo "\nError_code is : ".intl_get_error_code();
}
?>
@@ -106,32 +113,39 @@ if( intl_get_error_code() !=0 ){
isLenient() ){
- echo('TRUE');
-}else{
- echo('FALSE');
+$fmt = new IntlDateFormatter(
+ 'en_US',
+ IntlDateFormatter::FULL,
+ IntlDateFormatter::FULL,
+ 'America/Los_Angeles',
+ IntlDateFormatter::GREGORIAN,
+ 'dd/mm/yyyy'
+);
+echo 'lenient of the formatter is : ';
+if ($fmt->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->parse('35/13/1971');
+echo "\n Trying to do parse('35/13/1971').\nResult is : " . $fmt->parse('35/13/1971');
+if (intl_get_error_code() != 0) {
+ echo "\nError_msg is : " . intl_get_error_message();
+ echo "\nError_code is : " . intl_get_error_code();
}
$fmt->setLenient(FALSE);
-echo "Now lenient of the formatter is : ";
-if( $fmt->isLenient() ){
- echo('TRUE');
-}else{
- echo('FALSE');
+echo 'Now lenient of the formatter is : ';
+if ($fmt->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->parse('35/13/1971');
+echo "\n Trying to do parse('35/13/1971').\nResult is : " . $fmt->parse('35/13/1971');
+if (intl_get_error_code() != 0) {
+ echo "\nError_msg is : " . intl_get_error_message();
+ echo "\nError_code is : " . intl_get_error_code();
}
?>
@@ -146,7 +160,9 @@ Trying to do parse('35/13/1971').
Result is : -2147483
Now lenient of the formatter is : FALSE
Trying to do parse('35/13/1971').
-Result is : Error_msg is : Date parsing failed: U_PARSE_ERROR Error_code is : 9
+Result is :
+Error_msg is : Date parsing failed: U_PARSE_ERROR
+Error_code is : 9
]]>
diff --git a/reference/intl/dateformatter/set-pattern.xml b/reference/intl/dateformatter/set-pattern.xml
index 2c4433d7e1..4527b6adc0 100644
--- a/reference/intl/dateformatter/set-pattern.xml
+++ b/reference/intl/dateformatter/set-pattern.xml
@@ -70,12 +70,18 @@
]]>
@@ -86,12 +92,18 @@ echo "Second Formatted output with pattern is ".datefmt_format( $fmt , 0);
getPattern();
-echo "First Formatted output is ".datefmt_format( $fmt , 0);
+$fmt = new IntlDateFormatter(
+ 'en_US',
+ IntlDateFormatter::FULL,IntlDateFormatter::FULL,
+ 'America/Los_Angeles',
+ IntlDateFormatter::GREGORIAN,
+ 'MM/dd/yyyy'
+);
+echo 'pattern of the formatter is : ' . $fmt->getPattern();
+echo 'First Formatted output is ' . $fmt->format(0);
$fmt->setPattern('yyyymmdd hh:mm:ss z');
-echo "Now pattern of the formatter is : ".$fmt->getPattern();
-echo "Second Formatted output is ".datefmt_format( $fmt , 0);
+echo 'Now pattern of the formatter is : ' . $fmt->getPattern();
+echo 'Second Formatted output is ' . $fmt->format(0);
?>
]]>
diff --git a/reference/intl/dateformatter/set-timezone-id.xml b/reference/intl/dateformatter/set-timezone-id.xml
index 17cd9e2aec..afe0d951e3 100644
--- a/reference/intl/dateformatter/set-timezone-id.xml
+++ b/reference/intl/dateformatter/set-timezone-id.xml
@@ -69,10 +69,16 @@
]]>
@@ -82,10 +88,16 @@ echo "Now timezone_id of the formatter is : ".datefmt_get_timezone_id($fmt);
getTimezoneId();
+$fmt = new IntlDateFormatter(
+ 'en_US',
+ IntlDateFormatter::FULL,
+ IntlDateFormatter::FULL,
+ 'America/Los_Angeles',
+ IntlDateFormatter::GREGORIAN
+);
+echo 'timezone_id of the formatter is : ' . $fmt->getTimezoneId();
$fmt->setTimezoneId('CN');
-echo "Now timezone_id of the formatter is : ".$fmt->getTimezoneId();
+echo 'Now timezone_id of the formatter is : ' . $fmt->getTimezoneId();
?>
]]>