php - 日期显示错误
问题描述
I have a date picker, when the date is selected and submitted, it displays a different date all together.
例如:如果我从日期选择器中选择 04/20/2020 并单击提交,则显示的日期为 01/01/1970。
知道这是为什么吗?
<form action="includes/generatelog.php" method="post" name="generatelogform">
Entries in the activity log will be generated for the date entered below.<br><br>
<label>Process Date: </label> <input id="flatpickr" name="date" value"">
<button type="submit" class="btn btn-primary" name="generatelog">Generate Log Entries</button>
生成日志.php:
<?php
$con = mysqli_connect("localhost", "admin", "");
$db = mysqli_select_db($con, 'mydate');
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
if(isset($_POST['generatelog']))
{
$date = date("m-d-Y", strtotime($_POST["date"]));
$day = date("l");
echo "Today's date is ", $day,"\n", $date;
?>
这曾经可以工作,但现在不行了。我不确定为什么它显示错误的日期。
解决方案
推荐阅读
- python - 根据散点图中的接近度排除数据点
- r - 如何使用 R 中的 for 循环基于列创建数据框的子集
- android - Android Kotlin:使用 EXTRA_OUTPUT 保存的照片为 0 字节
- php - 如何使用 PHP 将正确的日期从 mdY 转换为 Ymd
- angular - 修剪字段值并在 onchange 事件 angular 中设置值
- debugging - 压力测试并发:如何减慢我的应用程序中的线程执行速度?
- javascript - SyntaxError:导入声明只能出现在带有 gulp 网页的模块的顶层
- c# - 服务总线重试逻辑:更喜欢队列重试还是实现 Polly?
- tkinter - tkinter:具有不同颜色的进度条
- c++ - 删除列表的一部分 C++