The date_format function formats date and time values in a specified format.
$date = date_create('2019-01-17'); echo date_format($date, 'y/m/d') . "<br>"; echo date_format($date, 'y/m/d h:i:s') . "<br>"; echo date_format($date, 'g:i A') . "<br>"; echo date_format($date, 'G:i a') . "<br>";
-> 19/01/17
19/01/17 12:00:00
12:00 AM
0:00 am
php function reference
http://php.net/manual/en/function.date.php
It was said “date — Format a local time/date”
In laravel, if you want to set yyyy/mm/dd and hh:mm to validation, the specification of the format is the following code.
$validator = Validator::make($request->all(),[ 'date' => 'date_format:Y/m/d', 'time' => 'date_format:H:i', ]);