Skip to content
Advertisement

Why is the value of datetime-local format changing to UTC instead of T?

I am trying to get the value of the datetime-local type of input which is 2020-09-20 16:03:00 from the database. To show this value in the input, I need the format Y-m-dTH:m so that the value with become 2020-09-20T16:03:00 but instead of that, the T will become UTC so the input won’t show the value because it is the wrong format.

<input type="datetime-local" value="{{ date('Y-m-dTH:m', strtotime($document->date_received)) }}">

Thanks to this link, I got the right format https://stackoverflow.com/a/49004716/7074729

Advertisement

Answer

Just add before the T Y-m-dTH:m into Y-m-dTH:m

Correct answer by apokryfos in the comment section

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement