Click here to Skip to main content
15,916,042 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
how to display year of given date of birth in lable
Posted

1 solution

Hi,
C#
Label1.Text = Convert.ToDateTime(TextBox1.Text).Year.ToString();


ASP.NET
<div>
       <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
       <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
       <asp:Button ID="Button1"
           runat="server" Text="Button" onclick="Button1_Click" />
   </div>

best regards
M.Mitwalli
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900