简体   繁体   English

如何与日期选择器一起添加时间选择器

[英]how to add time picker along with date picker

i have searched a lot in internet and tried them but all of them are not working my problem is how to display time picker along with date picker 我在互联网上搜索了很多,并尝试了它们,但所有这些都无法正常工作,我的问题是如何显示时间选择器和日期选择器

i already have this code for date picker 我已经有此代码用于日期选择器

 <html> <head> <title>datetimepicker</title> <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.10.0.min.js" type="text/javascript"></script> <script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.10.2/jquery-ui.min.js" type="text/javascript"></script> <link href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.9.2/themes/blitzer/jqueryui.css"rel="Stylesheet" type="text/css" /> <script type="text/javascript" src="http://cdn.jsdelivr.net/json2/0.1/json2.js"></script> </head> <body> <input class="w3-input w3-border " type="text" id="txt_fupdate" size="25" title="Follow Up Date" placeholder="Follow Up Date " runat="server" required> <script type="text/javascript"> $(function () { $("#txt_fupdate").datepicker({ dateFormat: "dd-mm-yy" }).val() }); </script> </body> </html> 

my question is how can i add or update that code to get time picker please help regarding this. 我的问题是我如何添加或更新该代码以获得时间选择器,请对此提供帮助。

Have a look at this plugin: http://xdsoft.net/jqplugins/datetimepicker/ 看看这个插件: http : //xdsoft.net/jqplugins/datetimepicker/

Alternatively, I would suggest that you can add an extra textbox on to the right of the datepicker and bind it with time picker like this one. 另外,我建议您可以在日期选择器的右侧添加一个额外的文本框,并将其与像这样的时间选择器绑定。

As said, you need a plugin, Try this one: https://plugins.jquery.com/simple-dtpicker/ 如前所述,您需要一个插件,请尝试以下插件: https : //plugins.jquery.com/simple-dtpicker/

Remember to include required files in your folder 请记住在文件夹中包含必需的文件

jquery.simple-dtpicker.js and jquery.simple-dtpicker.css jquery.simple-dtpicker.js和jquery.simple-dtpicker.css

And your code suppose to look like this: 您的代码应该看起来像这样:

<html>

<head>
        <title>datetimepicker</title>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script>
        <script src="https://cdn.rawgit.com/mugifly/jquery-simple-datetimepicker/72933bbe/jquery.simple-dtpicker.js"></script>
        <link href="https://cdn.rawgit.com/mugifly/jquery-simple-datetimepicker/72933bbe/jquery.simple-dtpicker.css" rel="stylesheet" />
    </head>

    <body>

        <input id="txt_fupdate" class="w3-input   w3-border " placeholder="Follow Up Date " required="" size="25" title="Follow Up Date" type="text" />
        <script type="text/javascript">
            $(function() {
                $('#txt_fupdate').appendDtpicker({
                    "closeOnSelected": true

                });


            });
        </script>

    </body>

    </html>

Its simple and has several good features such localization. 它简单易行,并具有本地化等几个良好功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM