PHP 8.5.0 Alpha 1 available for testing

IntlDateFormatter::getErrorMessage

datefmt_get_error_message

(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)

IntlDateFormatter::getErrorMessage -- datefmt_get_error_messageLee el último mensaje de error

Descripción

Estilo orientado a objetos

public IntlDateFormatter::getErrorMessage(): string

Estilo por procedimientos

datefmt_get_error_message(IntlDateFormatter $formatter): string

Lee el mensaje de error de la última operación.

Parámetros

formatter

El recurso de formateador IntlDateFormatter.

Valores devueltos

La descripción del último error.

Ejemplos

Ejemplo #1 Ejemplo con datefmt_get_error_message()

<?php
$fmt
= datefmt_create(
'en_US',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'America/Los_Angeles',
IntlDateFormatter::GREGORIAN
);
$str = datefmt_format($fmt);

printf(
"Error : %s (%d)\n",
datefmt_get_error_message($fmt),
datefmt_get_error_code($fmt)
);
?>

Ejemplo #2 Ejemplo orientado a objetos

<?php
$fmt
= new IntlDateFormatter(
'en_US',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'America/Los_Angeles',
IntlDateFormatter::GREGORIAN
);
$str = $fmt->format(0);

printf(
"Error : %s (%d)\n",
$fmt->getErrorMessage(),
$fmt->getErrorCode()
);

?>

El resultado del ejemplo sería:

Error : U_ZERO_ERROR (0)

Ver también

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top