Display Current Year

Dears

I want to show the current year on my website. (For the copyright logo, I don’t want to remember to update it yearly)

I followed the instructions on https://support.wix.com/en/article/how-to-display-todays-date-on-your-site and I’m able to show the current date.

How to change the code so I get the year in stead of the current date?
Sorry for this newbie question, it must be something small with the data type, but I can’t fix it.

I tried, $w(“#dateText”).text = today.getFullYear(); but that returns an error that 2018 is not of the type string.

Thanks for the assistance

Bruno

Try:

$w("#dateText").text = today.getFullYear().toString();

Thanks. That works

Thanks for the code, I was wondering if anyone knows how to add a year? so that the next year would be displayed?

I was able to get this to work, but I want to add the copyright symbol before the year and some text after. So it would look like this “© 2018 company name”. How do I do that in the javascript referenced above?

@ben thank you for the quick response. That worked perfectly.

Hi, When I get to the stage of pasting the code into the code panel it doesn’t give me an option to paste. can someone explain how I can add the code please?

See the article Corvid: Working in the Code Panel .

Thanks - already read that - didn’t help. I copy the code, open the panel, see where to add the code, click on the line “//TODO: write your page related code here…” , but no paste option appears in my right click menu - that is the issue I am having. It lets me type code in that space but I don’t want to type it all out, I want to copy/paste - is that not possible?

It’s just the usual keystrokes:
On a Mac: Command-V
On a PC: Ctl-V

OK, Ctrl-V works in PC to paste.

@ Andrew Galdi What was the answer? I don’t see it.

1 Like