dongzhuner6981 2018-04-11 05:37
浏览 262
已采纳

将我的日期选择器格式从(YYYY / MM / DD)更改为(YYYY-MM-DD)

My datepicker format is (YYYY/MM/DD) , my sql only reads (YYYY-MM-DD) format My system only accepts that specific format or the show report wont work properly. Is there anything that i could add , so when i click the specific date the format will be (YYYY-MM-DD)

What should i do please help me. H Thanks

This is my php file

<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>
  • 写回答

3条回答 默认 最新

  • douzi8112 2018-04-11 05:41
    关注

    inside the jQuery script code just paste the code.

    $( ".selector" ).datepicker({ 
        dateFormat: 'dd-mm-yy' 
    });
    

    Note : You can change this format as you required. just edit code as per your requirement.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)