locked
C# Getting the year with out declaring a variable. RRS feed

  • Question

  • User-2121587974 posted

    I am trying to put the current year at the bottom of my website for copy right reasons.  I am using razor and my files are cshtml.

    in the footer layout page I have mostly HTML, the code there is the @rednderBody() and a Layout to bring in the other layout pages.

    The code I am trying is this,

    <br>@System.DateTime.Year(Now); &copy;



    I want to beable to print the current year without having to declare a variable.

    Thanks.

    Monday, October 6, 2014 4:15 PM

Answers

  • User-760709272 posted

    @System.DateTime.Now.Year

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, October 6, 2014 4:24 PM

All replies

  • User-760709272 posted

    @System.DateTime.Now.Year

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, October 6, 2014 4:24 PM
  • User-2121587974 posted

    Thank you.

    Monday, October 6, 2014 4:31 PM