Hi Vasanth, You needs to code a logic for this as follow.,
<div>
<asp:TextBox ID="txtInput" runat="server"></asp:TextBox>
<asp:TextBox ID="txtOutput" runat="server" ReadOnly="true"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Convert" onclick="Button1_Click" />
<asp:Label ID="lblError" runat="server"></asp:Label>
</div>
protected void Button1_Click(object sender, EventArgs e)
{
string inputTime = txtInput.Text.ToUpper();
string outputTime = "";
string timeFormate = inputTime.Substring(inputTime.Length - 2);
switch (timeFormate)
{
case ("AM"):
outputTime = inputTime.Replace("AM", "") + " : 00 ";
break;
case ("PM"):
int hours = 0;
int.TryParse(inputTime.Replace("PM", ""), out hours);
outputTime = (hours + 12).ToString() + " : 00 ";
break;
default:
lblError.Text = "Invalid Time";
break;
}
txtOutput.Text = outputTime;
}
thanks,
rk.