Last day of the month | Community
Skip to main content
ashleym1988
Level 2
Sep 13, 2018 12:40 PM UTC
Solved

Last day of the month

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Amit_Kumar
Amit_KumarAccepted solution
Level 10
Sep 17, 2018 9:01 AM UTC

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

2 replies

Amit_Kumar
Amit_KumarAccepted solution
Level 10
Sep 17, 2018 9:01 AM UTC

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

Translate
saikatk2447661
Level 4
Sep 13, 2018 6:20 PM UTC

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")

Translate