Show value in a datetime-local type input

Asked

Viewed 295 times

0

I have this code:

$tabela5 .= '<td> <input type="datetime-local" name= "DataInicio" id= "DataInicio" value="'. date("Y-m-d H:i:s") .'"></td>';

But the input does not show the current date and time.

1 answer

1


Trade for this:

date("Y-m-d\TH:i:s")

In HTML you must have a T between date and time. The \ is to escape it

Browser other questions tagged

You are not signed in. Login or sign up in order to post.