0
我想將時間戳值轉換爲日期格式在樹枝文件,但我得到以下錯誤。時間戳到日期格式不工作在樹枝
{{ form_row(form.startDate)|date("m/d/Y") }}
錯誤:
An exception has been thrown during the rendering of a template ("DateTime::__construct(): Failed to parse time string (<div><label for="event_setup_startDate" class="required">Start date</label><input type="text" id="event_setup_startDate" name="event_setup[startDate]" required="required" class="datetimepicker" value="1478257800" /></div>) at position 0 (<): Unexpected character")
您正在將由form_row函數生成的HTML代碼傳遞給日期構造函數。你在使用框架嗎? – Matteo
@Matteo。我正在使用symfony框架。 datetype設置爲字符串,並試圖將其轉換爲日期時間格式。 – user1965773