Today i will tell you how to retrieve year from date using C#.Net.
In the Previous articles i explained how to retrieve logged in user name in asp.net, how to retrieve logged in user email in asp.net, where to place google analytics tracking code, how to retrieve day from date using C#.net, how to retrieve month from date in c#.net and many more about C#.Net.
Today or in future you will have to get year from date for programming purpose.
Drag and Drop one Button and a TextBox control from toolbox into Form.
Write below line of code on click event of button.
textBox1.Text = DateTime.Now.Year.ToString();
Here what we are doing is getting year from current date of server.