Article About php Function Date_CreateImmutableFromFormat
Article about php function date_create_immutable_from_format
Returns a new DateTimeImmutable instance or false on failure. This function is an alias of the DateTimeImmutable::createFromFormat() method. It accepts a time string and a format string, parses the given string and returns the parsed structure.
DateTimeImmutable::getLastErrors() provides a way to query last errors that occur during date parsing. Error messages are also appended to the returned structure if an unrecognized character in the format string was encountered.
For example, if the format string includes the letter i and there are two following digits, the date_create_immutable_from_format() method will greedily read those digits as minute (i) and seconds (s). This can cause an overflow of the date portion of the structure, for instance 97 seconds overflows to 1 minute and leaves 37 seconds.
Similarly, if the format string contains the letter y and there are not enough remaining days in the year to represent that number, then the day of the week will be changed to Mon or Sun instead of Tue or Wed.