php check valid time format

Solutions on MaxInterview for php check valid time format by the best coders in the world

showing results for - "php check valid time format"
Louca
12 Oct 2017
1function isValidDate(string $date, string $format = 'Y-m-d'): bool
2{
3    $dateObj = DateTime::createFromFormat($format, $date);
4    return $dateObj && $dateObj->format($format) == $date;
5}
6