.net – Current Year in ASP.NET MVC 3

asp.net-mvc-3netrazor

I want to add Copyright @ 'current_year' to the footer (in cshtml file) of my page. I often made it using javascript but since I am using ASP.NET MVC 3 I would like to do this using ASP.

I was trying construction like:

@response.write("Current Year: "&Year(Date))

But it didn't work in MVC 3 and I can't find solution that is working.

Best Answer

Try the following:

Copyright @@ @DateTime.Now.Year