Get current year for copyright statement


This is probably a very simple question but after a bit of searching I can’t find an answer here so I am asking! I want to output the current year in my site footer as part of the copyright statement. Is this possible? The statement looks like this:

Copyright My Website 2020 - {currentYear}

I need to fill in the currentYear bit. Bonus points if I can do a check to see if current year matches launch year, and only show the currentYear bit if it doesn’t

Thanks for any help!

Welcome to the forum…

<?= date("Y"); ?>

For the bonus points you can probably use the Kirby e() helper

<?= e(date("Y") === '2020', '2020', '2020 - ' . date("Y")) ?>
1 Like :wink:


Just the ticket - thank you!