1
例如,我有一個文本框,我要在其中默認設置數據庫中的值。我能做到這一點是這樣的:如何在默認情況下設置HTML日期時間輸入值
<input type="text" name="abcd" value="<[email protected]$result['xyz'];?>"/>
好吧,它適用於這種類型的字段。
不過,我想這樣做,像這樣的日期時間字段:
$datetime = $result['datetime'];
//already converted to format("d/m/Y, h:i:s A")
<input type="datetime-local" value="<[email protected]$datetime?>" name="abc"/>
我已經嘗試轉換數據庫日期 - 時間格式,以適應這種格式。沒有結果。
想法?謝謝!
也許這將有助於將日期轉換爲[此格式](http://www.w3.org/TR/html-markup/input.datetime-local.html#input.datetime-local.attrs.value )? –
可能重複的[輸入類型日期時間 - 值格式?](http://stackoverflow.com/questions/10854874/input-type-datetime-value-format) – nhee
@nhee同意,也提到在那裏的帖子,正確PHP的DateTime格式爲Ymd \ TH:i:sP – Arend