Automatically changing year in Copyright notice?


#1

For example I have a website which was created in 2016.
Now’s 2017.

So the code in footer looks like this:
Copyright © 2016 - 2017 Website example. All rights reserved.

Of course I can manually change that year, but how to make that year to be changing with the actual year? For example it’s year 2018, so the year will automatically change from 2017 to 2018.

Any ideas how to do this?


(Mark Hunte) #2

You would need to use JavaScript that gets the current date- year and use it in a text string to write the text of the Text element.
There would be no need to do a comparison
On iPad at mo. But something like;

var thisDate = new Date();
var yearDate = thisDate.getFullYear();
  hypeDocument.getElementById('copyright').innerHTML = "Copyright © 2016 -" + yearDate

Run at on scene load.

See:

https://www.w3schools.com/jsref/jsref_getfullyear.asp