pickadate.js-3.5.3将字符串日期转换为mysql DATE的正确格式

时间:2014-11-29 13:59:02

标签: javascript jquery html pickadate

我对javascript / jquery的了解很少,并且我试图使用pickadate.js-3.5.3使用html / php / mysql传递日期我需要从pickadate.js-3.5.3 date获取用户输入日期函数并将其转换为MYSQL中可用于DATE数据类型的格式

这是我到目前为止的代码;

<p id="datepairExample">Date:<input class="fieldset__input js__datepicker" name="datepicker1" value="" type="text" placeholder="Date"> </p><br/>

   <script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>

   <script src="dt/js/legacy.js"></script>
    <script src="dt/js/picker.js"></script>
    <script src="dt/js/picker.date.js"></script>
    <script src="dt/js/picker.time.js"></script>
     <script>window.jQuery||document.write('<script src="pickadate.js-3.5.3/tests/jquery.2.0.0.js"><\/script>')</script>
    <script src="dt/demo.js"></script>

我已经阅读了有关如何执行此操作的文档,甚至尝试将演示中的代码复制并粘贴到我自己的页面中,但没有运气!欢迎任何建议!感谢

1 个答案:

答案 0 :(得分:2)

http://amsul.ca/pickadate.js/date.htm#formats

UPDAT2 2

<link rel="stylesheet" href="lib/themes/default.css" id="theme_base">
<link rel="stylesheet" href="lib/themes/default.date.css" id="theme_date">
<link rel="stylesheet" href="lib/themes/default.time.css" id="theme_time">

<!--[if lt IE 9]>
    <script>document.createElement('section')</script>
<![endif]-->


<body>

<form>
   <input class="datepicker" name="datepicker1" type="text" placeholder="Try me&hellip;">

   <input type="submit" />
</form>  




    <script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
    <script>window.jQuery||document.write('<script src="tests/jquery.2.0.0.js"><\/script>')</script>
    <script src="lib/picker.js"></script>
    <script src="lib/picker.date.js"></script>
    <script src="lib/picker.time.js"></script>


    <script>

        $(function() {
            $('.datepicker').pickadate({
                formatSubmit: 'yyyy-mm-dd',
                hiddenName: true
            })    
        });

    </script>

</body>