I use following date validation for incoming POST request.
'trep_txn_date' => 'date_format:"Y-m-d H:i:s.u"'
This will only allow a date of this kind i.e. 2012-01-21 15:59:44.8
I also want to allow date without the TIME e.g. 2012-01-21, which when sent to mysql db will automatically store as 2012-01-21 00:00:00.0
Is there a way I can do this using a Laravel's existing validation rules. Is there a way to define multiple formats in date_format rule something like below.
'trep_txn_date' => 'date_format:"Y-m-d H:i:s.u","Y-m-d"' //btw this didn't work.