我如何设置输入类型'datetime-local'的值? [英] How can i set a value for the input type 'datetime-local'?
问题描述
我试过这个:
< input type =datetime-localvalue =<?php echo $行['时间'];?> class =datename =startREQUIRED>
我怎样才能设定这个输入字段的值与数据库中的数据?
它不起作用!!
我也需要编辑它。
或者我应该使用其他类型的输入吗?
$ row ['Time'];是来自数据库的!
我不知道 定义 一个在 RFC 3339 中定义的有效日期时间,带这些 解决方案 要在PHP中创建 RFC 3339 格式,您可以使用: 或以其他方式: 在您的代码 所以在你的代码里它看起来如下: 或 手动 p> 更多信息可以在 here I tried this: How can i set the value of this input field with the data from the database? I don't know exacly what is in Definition A valid date-time as defined in RFC 3339 with these
additional qualifications: Examples
Solution To create RFC 3339 format in PHP you can use: or in another way:
In your code So in your code it would look as follows: or
Manual More informations can be found here 这篇关于我如何设置输入类型'datetime-local'的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
附加限定条件:
$ b >
echo date ('Ymd'\\TH:我:sP',$ row ['时间]);
<$ p $回声日期(c,strtotime($ row ['Time']));
< ; input type =datetime-localvalue =<?php echo date('Ymd'\\TH:i:sP',$ row ['Time']);?> class =datename =startREQUIRED>
< input type =datetime-localvalue =<?php echo date(c,strtotime($ row ['Time']));?> class =datename =startREQUIRED>
<input type="datetime-local" value="<?php echo $row['Time']; ?>" class="date" name="start" REQUIRED>
It doesn't work!!
I need to make it possible to edit too.
Or should I use another type of input?
$row['Time']; is from the database!$row['Time']
but it should be as follows:
echo date('Y-m-d\TH:i:sP', $row['Time']);
echo date("c", strtotime($row['Time']));
<input type="datetime-local" value="<?php echo date('Y-m-d\TH:i:sP', $row['Time']); ?>" class="date" name="start" REQUIRED>
<input type="datetime-local" value="<?php echo date("c", strtotime($row['Time'])); ?>" class="date" name="start" REQUIRED>