CakeFest 2024: The Official CakePHP Conference

IntlDateFormatter::getErrorCode

datefmt_get_error_code

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

IntlDateFormatter::getErrorCode -- datefmt_get_error_codeLit le code d'erreur de la dernière opération

Description

Style orienté objet

public IntlDateFormatter::getErrorCode(): int

Style procédural

datefmt_get_error_code(IntlDateFormatter $formatter): int

Renvoie le code d'erreur de la dernière opération de formatage.

Liste de paramètres

formatter

La ressource de formateur IntlDateFormatter.

Valeurs de retour

Le code d'erreur, une des valeurs UErrorCode. La valeur initiale est U_ZERO_ERROR.

Exemples

Exemple #1 Exemple avec datefmt_get_error_code()

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

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

Exemple #2 Exemple orienté objet

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

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

L'exemple ci-dessus va afficher :

Erreur : U_ZERO_ERROR (0)

Voir aussi

add a note

User Contributed Notes

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