Change language

PHP IntlDateFormatter getErrorCode () function,

Syntax:
  • Object Oriented Style:
    int IntlDateFormatter::getErrorCode (void )
  • Procedural style:
    int datefmt_get_error_code (IntlDateFormatter $fmt)
Parameters:This function uses a single $fmt parameter,which contains the formatter resource.Returned value: This function returns an error code, one of the UErrorCode values. The initial value is U_ZERO_ERROR.The following program illustrates the IntlDateFormatter::getErrorCode() function in PHP:Program :  
// Create date formatter $formatter = datefmt_create ( ’en_US’ , IntlDateFormatter::SHORT, IntlDateFormatter::SHORT, ’Asia / Kolkata’ , IntlDateF ormatter::GREGORIAN );  
// Format date / time value // as a string $str = datefmt_format ( $formatter ); if (! $str ) { echo " Error code: " . datefmt_get_error_code ( $formatter ). "" ; echo " Error message: " . datefmt_get_error_message ( $formatter ); } echo "" ;  
// Format date / time value // as a string $str = $formatter -> format ( "engineer" ); if (! $str ) { echo " Error code: " . $formatter -> getErrorCode(). "" ; echo " Error message: " . $formatter -> getErrorMessage(); }  
?>
Error:
PHP Warning: datefmt_format() expects exactly 2 parameters, 1 given in /home/700d8660f05cec95beb6e1ab21252ab1.php on line 14
Exit:
Error code: 0 Error message: U_ZERO_ERROR Error code: 1 Error message: datefmt_format: string ’engineer’ is not numeric, which would be required for it to be a valid date: U_ILLEGAL_ARGUMENT_ERROR
Link: https://www.php.net/manual/en/intldateformatter.geterrorcode.php

Shop

Best laptop for Sims 4

$

Best laptop for Zoom

$499

Best laptop for Minecraft

$590

Best laptop for engineering student

$

Best laptop for development

$

Best laptop for Cricut Maker

$

Best laptop for hacking

$890

Best laptop for Machine Learning

$950

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

12 answers

NUMPYNUMPY

How to convert Nonetype to int or string?

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

12 answers

Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method