以HH:MM格式输入IN TIME和OUT TIME [英] Enter IN TIME and OUT TIME in HH:MM format

查看:46
本文介绍了以HH:MM格式输入IN TIME和OUT TIME的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要一个功能,使用户可以在文本框中以以下格式输入时间

I want a functionality where a user can enter time in the below format in the textbox

InTime:hh:mm//员工第一个文本框的时间

OutTime:hh:mm//员工第二个文本框的退出时间

第三文本框

员工总时间:此处的总和来自两个文本框.

Total Time of the employee: Here total will come from both the textboxes.

下面是我的HTML.请帮助

Below is my HTML for the same. Kindly help

<tr>
            <td>
                <asp:Label ID="lblInTime" runat="server" Text="In Time" Visible="true"></asp:Label>&nbsp;
                <asp:TextBox ID="txtInTime" runat="server" Width="50">
                </asp:TextBox>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="lblOutTime" runat="server" Text="Out Time" Visible="true"></asp:Label>&nbsp;
                <asp:TextBox ID="txtOutTime" runat="server" Width="50">
                </asp:TextBox>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="lblTotalHr" runat="server" Text="Total Hours" Visible="true"></asp:Label>&nbsp;
                <asp:TextBox ID="txtTotalHrs" runat="server" Width="70" ReadOnly="true">
                </asp:TextBox>
            </td>
        </tr>

推荐答案

您可以使用 TextMode ="Time" 来输入用户的时间.

You can use TextMode="Time" for time to be input from user.

<asp:TextBox ID="txtInTime" runat="server" Width="50" TextMode="Time"></asp:TextBox>

注意

TextMode 属性,并且只有最新的浏览器才能识别该属性,因为它将被转换为 HTML5 输入标签

TextMode property is available in asp.net 4.5 and above and this will be only recognized by latest browsers as this will be converted into HTML5 input tag

<input name="txtTime" type="time">

这篇关于以HH:MM格式输入IN TIME和OUT TIME的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆