I have this code:
<input type="datetime-local" name="date" value={{$date}} readonly >
$date
is with hours and minutes but it just give me an empty time whenever I use it.
I tried with type="datetime"
and it gives me the time without hh:mm
, how can I get it all?
EDIT: It worked, $date
must be timestamp
in the database and the input type must be of type datetime
CodePudding user response:
Make sure you surround the date value with quotes and provide it in ISO format:
<input type="datetime-local" name="date" value="{{$date}}" readonly>
Your $date
should be in the format 2022-07-31T15:35
for instance. Note the T
in the middle.