Alina Anjum Alina Anjum - 5 months ago 21x Question

C# Get year part from date

I am converting an existing vb application to .net, in the existing code i found the condition below.How can I write this condition in C# ? Thanks in Advance

if CLng(Right(request("yr"),4))=CLng(Year(Date())) then
//I am confused only in Year(Date()) how can I replace these functions in C#


Year(Date()) can be written as DateTime.Now.Year