I had problem validating date-time string in Laravel.
Here is a rule:
'time_in' => 'date_format:dd/MM/yyyy HH:mm',
And here is an image of how it's actually written:
By all account, it should work. What gives?
CodePudding user response:
You're describing format in a wrong way. Should be:
'time_in' => 'date_format:d/m/Y H:i',
CodePudding user response:
date_format:format
The field under validation must match the given format. You should use either date or date_format when validating a field, not both. This validation rule supports all formats supported by PHP's DateTime class.
check laravel docs about validation rules : https://laravel.com/docs/9.x/validation#rule-date-format.