Unknown or bad format (%s)

Description

This error is emitted by the Date extension, when creating a DatePeriod class. That class requires a start date as the first argument, and the provided value could not be parsed.

Example

<?php

new DatePeriod('L');

?>

Literal Examples

  • Unknown or bad format (L)

Solutions

  • Use a valid date.

  • Use a DateTimeInterface object as first argument: DateTimeImmutable, DateTime, etc.

  • Use the DatePeriod::createFromISO8601String() method to handle ISO 8601 formats.