Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要一种方法使日期时间格式看起来像这样:“2013-10-23T12:30”
我是这样做的,但它不起作用:
echo "<input name='showdatetime' type='datetime-local' id='showdatetime' value='" . date( "Y-m-dAh:i" , $show->datetime ) . "'><br/>";
谢谢
尝试这个:
$date = getdate(); echo "<input name='showdatetime' type='datetime-local' id='showdatetime' value='" . date( "Y-m-d h:i A",$date[0] ) . "'><br/>";
您可以使用\转义字符,例如 T。因此您需要以下格式:
\
date('Y-m-d\TH:i')
请参阅PHP 日期文档中的示例 2