Alina Anjum Alina Anjum - 2 years ago 163 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#

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download