Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Printing the last weekday in content editor for email

Avatar

Avatar
Validate 1
Level 1
oscarr88498187
Level 1

Like

1 like

Total Posts

1 post

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
oscarr88498187
Level 1

Like

1 like

Total Posts

1 post

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
oscarr88498187
Level 1

27-11-2018

Hi I have a question regarding date formatting in content editor. I want to be able to set up so that the last friday of a month is being displayed in the following way:

"Do not forget to get back to us by Friday DD Month"

Where Friday DD Month equal the date of the last friday e.g. Friday 29 November.

How can I achieve this?

KR

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Contributor
MVP
wodnicki
MVP

Likes

938 likes

Total Posts

1,061 posts

Correct Reply

495 solutions
Top badges earned
Contributor
Shape 1
Give Back 100
Give Back 50
Give Back 25
View profile

Avatar
Contributor
MVP
wodnicki
MVP

Likes

938 likes

Total Posts

1,061 posts

Correct Reply

495 solutions
Top badges earned
Contributor
Shape 1
Give Back 100
Give Back 50
Give Back 25
View profile
wodnicki
MVP

04-01-2019

Hi,

Use this:

Do not forget to get back to us by <%

var dt = new Date(); // fill with desired date, e.g. new Date(@date), or leave empty for time of send

var eom = new Date(dt.getFullYear(), dt.getMonth() + 1, 0);

var lf = new Date(eom.getFullYear(), eom.getMonth(), eom.getDate() - (7 - Math.abs(eom.getDay() - 5)) % 7);

document.write(lf.toLocaleDateString('en-Us', {weekday: 'long', day: 'numeric', month: 'long'}));

%>

Thanks,

-Jon

Answers (0)