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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Last day of the month

Avatar

Level 2

Hi Guys,

I am trying to pull through the last day of the month within an email send in the format MM/DD/YYY however, I cannot find a function to do so. Is this possible? if so can someone point me in the right direction.

Thanks,

Ashley

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi Ashley,

You should add an enrichment and add the following attribute as an additional attribute for a date.

SubMinutes(AddMonths(YearAndMonth(GetDate()), 1), 1) as @lastDate

Then you can add a

formatDate(targetData.lastDate,"%2M/%2D/%4Y")

in your delivery.

Regards,

Amit

View solution in original post

2 Replies

Avatar

Level 4

Try the following code.

var d=new Date();

d.setDate(1)

d.setMonth(d.getMonth()+1)

d.setDate(d.getDate()-1)

var date=formatDate(d,"%2M/%2D/%4Y")

Avatar

Correct answer by
Community Advisor

Hi Ashley,

You should add an enrichment and add the following attribute as an additional attribute for a date.

SubMinutes(AddMonths(YearAndMonth(GetDate()), 1), 1) as @lastDate

Then you can add a

formatDate(targetData.lastDate,"%2M/%2D/%4Y")

in your delivery.

Regards,

Amit