PHP date_get_last_errors() function

PHP date_format() function
PHP date_interval_create_from_date_string() function

In this article, you will learn how to grab the errors in parsing a date string. The date_get_last_errors() function does the job.

What is the syntax of the date_get_last_errors() function in PHP?

date_get_last_errors()

Examples of the date_get_last_errors() function

Example 1. In the following example, we tried to parse an invalid string in the date_create function and then use the date_get_last_errors() method to grab the error.

<?php
date_create("yasfuhswefk%&/");
print_r(date_get_last_errors());
?>
PHP date_format() function
PHP date_interval_create_from_date_string() function

Stay up-to-date about PHP!

We don’t spam!

en English
X
Scroll to Top