1
Answer

I want to display a time 12h foramt like hh:mm:ss in TextBox

Ask a question
manjula d

manjula d

11y
3k
1
I want to display a time foramt like hh:mm:ss in TextBox like [12:30:59] but i was used in masked edit extender control for 24 hour format like mask:99:99:99
but i want to display a time for 12hours format how to do any examples if you know  please help me to solve ................................





THIS IS MY CODE:

<cc1:MaskedEditExtender ID="meetime" runat="server" TargetControlID="txtTime" MessageValidatorTip="false"
                                                    MaskType="Time" Mask="99:99:99" UserTimeFormat="TwentyFourHour" CultureName="en-US">
<asp:CustomValidator ID="cvtime" runat="server" ForeColor="Red" ClientValidationFunction="Time1"
                                                    ControlToValidate="txtTime" ErrorMessage="Plese Select 24Hours Time Format" ValidationGroup="add"
                                                    ToolTip="Please Select 24Hours Time Format" Display="Dynamic">
                                                </asp:CustomValidator>



 function Time1(source, args) {
            var Timedata = $("#<%=txtTime.ClientID %>").val();
            if (Timedata != "") {
                var timeArray = Timedata.split(':');
                if (timeArray[0] > 0 && timeArray[0] <= 23) {
                    if (timeArray[1] <= 59 && timeArray[2] <= 59) {
                        args.IsValid = true;
                    }
                    else {
                        args.IsValid = false;
                    }

                }
                else {
                    args.IsValid = false;
                }
            }

            else {
                args.IsValid = false;
            }
        }    </script>

Answers (1)