diff --git a/reference/datetime/datetimeimmutable/createfromformat.xml b/reference/datetime/datetimeimmutable/createfromformat.xml index c2182ff6e3..a4932ba1f8 100644 --- a/reference/datetime/datetimeimmutable/createfromformat.xml +++ b/reference/datetime/datetimeimmutable/createfromformat.xml @@ -549,6 +549,47 @@ Sat, 04 Jun 2022 17:01:37 +0000 + + + In order to detect overflows in dates, you can use the + DateTimeInterface::getLastErrors name, which will + include a warning if an overflow occured. + + + Detecting overflown dates + +format(DateTimeImmutable::RFC2822), "\n\n"; + +var_dump(DateTimeImmutable::GetLastErrors()); +?> +]]> + + &example.outputs.similar; + + + int(2) + 'warnings' => + array(1) { + [19] => + string(27) "The parsed date was invalid" + } + 'error_count' => + int(0) + 'errors' => + array(0) { + } +} +]]> + + +