Php 将我的日期选择器格式从(YYYY/MM/DD)更改为(YYYY-MM-DD)
我的日期选择器格式是(YYYY/MM/DD),我的sql只读取(YYYY-MM-DD)格式 我的系统只接受特定格式,否则显示报告无法正常工作。 有什么我可以添加的,所以当我单击特定日期时,格式将是(YYYY-MM-DD) 我该怎么办?请帮帮我。 H 谢谢 这是我的php文件Php 将我的日期选择器格式从(YYYY/MM/DD)更改为(YYYY-MM-DD),php,Php,我的日期选择器格式是(YYYY/MM/DD),我的sql只读取(YYYY-MM-DD)格式 我的系统只接受特定格式,否则显示报告无法正常工作。 有什么我可以添加的,所以当我单击特定日期时,格式将是(YYYY-MM-DD) 我该怎么办?请帮帮我。 H 谢谢 这是我的php文件 <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scal
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
$( function() {
$( "#datepicker" ).datepicker();
} );
</script>
</head>
<?php include('session.php'); ?>
<?php include('header.php'); ?>
<body>
<div id="wrapper">
<?php include('navbar.php'); ?>
<div style="height:50px;"></div>
<div id="page-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">Inventory Report</h1>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<table width="100%" class="table table-striped table-bordered table-hover" id="invTable">
<thead>
<tr>
<center>
<form action="total_inventory.php" method="post">
<p>From: <input type="text" class="datepicker" placeholder="E.G.(2018-01-14)" name="dayfrom" required pattern="[0-9]{4}+[0-9]+[0-9]" id="datepicker">
To: <input type="text" class="datepicker" placeholder="E.G.(2018-02-11)" name="dayto" required pattern="[0-9]{4}+[0-9]+[0-9]" id="datepicker1">
<input type="submit" value="Show Report" name="salesbtn" ></form>
</center>
<th class="hidden"></th>
<th>Date</th>
<th>User</th>
<th>Action</th>
<th>Product Name</th>
<th>Quantity</th>
</tr>
</thead>
<?php include('script.php'); ?>
<?php include('modal.php'); ?>
<?php include('add_modal.php'); ?>
<script src="custom.js"></script>
</body>
</html>
$(函数(){
$(“#日期选择器”).datepicker();
} );
库存报告
发件人:
致:
日期
使用者
行动
品名
量
在jQuery脚本代码中,只需粘贴代码即可
$( ".selector" ).datepicker({
dateFormat: 'dd-mm-yy'
});
注意:您可以根据需要更改此格式。只需根据需要编辑代码。在日期选择器代码中添加日期选择器格式,如下所示
$( "#datepicker" ).datepicker({ dateFormat: 'yy-mm-dd' });
将该类用于所有日期字段,如下所示:
$( ".datepicker" ).datepicker({ dateFormat: 'yy-mm-dd' });
您可以通过调用日期选择器的方式修改配置,如下所示。我看到您正在使用jQueryUIDatePicker 这应该起作用:
$(函数(){
$(“#日期选择器”).datepicker({dateFormat:'yyyyy-mm-dd'});
});代码>