How to set a value for the input type 'datetime-local'?

后端 未结 10 1303
猫巷女王i
猫巷女王i 2020-12-25 11:59

I tried this:

\" class=\"date\" name=\"start\" REQUIRED>

H

10条回答
  •  情书的邮戳
    2020-12-25 12:18

    The answer of Karol Gasienica is a great explanation but somehow did not work for me even in their replies

    date('Y-m-d\TH:i:s', $row['Time']); //Gives me 1970-01-01 00:00
    date('Y-m-d\TH:i:sP', $row['Time']); //Gives me no display
    date("c", strtotime($row['Time'])); //No display too
    

    What worked for me is this

    $t = $row['Time'];
    date('Y-m-d\TH:i:s', strtotime($t)); // This got it perfectly
    

    However I still voted it up becauce of the explanation.

提交回复
热议问题