2 digit year for footer

<script>document.write(new Date().getFullYear())</script>
ā†‘ This snippet of code is great. Does anyone have a simple way to make that date the last two digits (23) of the year instead of four (2023). My brain hurts. Thanks!


Avoid using document.write is a sync API that blocks your site parsing .substr(-2) is what you need to get latest 2 chars of a string, so new Date().getFullYear().substr(-2) gives you 23. But use dom manipulation to write the text, Google will penalize your score

1 Like

Thanks for your help and advice. I did some studying and figured it out.