Home >>PHP Date Time Functions >PHP date_get_last_errors() Function

PHP date_get_last_errors() Function

PHP date_get_last_errors() Function

PHP date_get_last_errors() function is used to returns the warnings and errors occurs while parsing the date string. It parse a date/time string and returns an array of warnings and errors. It does not accept any input parameter.

Syntax:

 date_get_last_errors();

Here is an example of date_get_last_errors() function in PHP:

<html>
<body>

<pre>
<?php

date_create("abhimanyu");
print_r(date_get_last_errors());

?>
</pre>

</body>
</html>
Output:
Array
(
    [warning_count] => 1
    [warnings] => Array
        (
            [6] => Double timezone specification
        )

    [error_count] => 1
    [errors] => Array
        (
            [0] => The timezone could not be found in the database
        )

)

No Sidebar ads