How to retrieve Year from date in C#.Net - C#.Net Articles.

 

Introduction

Today i will tell you how to retrieve year from date using C#.Net.

History

In the Previous articles i explained how to retrieve logged in user name in asp.nethow to retrieve logged in user email in asp.netwhere to place google analytics tracking codehow 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.

Step 1.

Drag and Drop one Button and a TextBox control from toolbox into Form.

Step 2.

Write below line of code on click event of button.

textBox1.Text = DateTime.Now.Year.ToString();

That's It.

Here what we are doing is getting year from current date of server.

Give your Valuable Comments.
comments powered by Disqus
 
Follow me on twitter
About Me
Harpreet Singh
I began programming with C++ when i was 17. Then at the middle of my study .NET came. Then I began to read C# and VB.NET. By the time i learnt SQL and ASP.NET, and developed some websites such as news portals that are active now. Currently i am running my own Software company.
More Articles