C# Date Question?
How do I get the year so i can display via an ASPX page?
I currently have:
DateTime vDate = DateTime.Now;
and vDate displays just fine, but I only want to show the year, not the month, day and time.
- 1 decade agoFavorite Answer
The DateTime class has a property called Year that returns an integer so you could do
int vYear = vDate.Year;
int vYear = DateTime.Now.Year;