Dynamic date - auto update - month then year January - 2021

I want the date updated auto matically with just MMMM-y
January - 2021
Febuary - 2021

I ediited the scrip in design to this:

var date = formatter.dateLong(new Date(),“MMMM - y”);
results.html(date);

but then got:
January 31, 2021

any tips?

Sorry shocking English & gramma,

I have a letter template that I want to update automatically, I’ve used insert date, selected English (Unitied Kingdom) and picked the format 31 January 2021 and edited the script to the below:

var date = formatter.dateLong(new Date(),“MMMM - y”);
results.html(date);

I want to get Month (full text) and year January 2021 but the edit gave me:
January 31, 2021

As described in the documentation, you should use the formatter.date() method instead:

var date = formatter.date(new Date(),"MMMM - y");
results.html(date);

Thanks Phil, worked like a charm, I did look through the documentation but it can be a bit daunting from a cold start! Was due to go on a OL training course but it got called off because of Covid, would have been really helpful as the change to connect is quite different!