Expand my Community achievements bar.

Never miss an update of the Adobe Journey Optimizer Community Lens! Subscribe now to get the latest updates, insights, and highlights delivered straight to your inbox every time a new edition drops.

Date Helper Expression for First/Last Day of Current Month in AJO Template

Avatar

Level 5

Hi everyone,

 

I’m trying to generate dynamic dates inside an AJO Email/HTML template, specifically:

 

“Promotion valid from "01/{{current_month}}/{{current_year}}" to {{last day of current month}}/{{current_month}}/{{current_year}}.”

 

What is the correct PQL expression to generate the first day of the current month in AJO?

 

Thanks.

2 Replies

Avatar

Level 3

@Silvio6 Since there are no functions available to directly get first or last day of the  month you can try something like this:

Promotion valid from "01/{% let d=now %}{%= formatDate(d, "MM") %}/{%= formatDate(d, "YYYY") %}" to "{% let lastday= setDays(addMonths(d, 1), 1)%} {% let a = addDays(lastday, -1) %}{%= formatDate(a, "dd") %}/{%= formatDate(a, "MM") %}/{%= formatDate(a, "YYYY") %}"

 

Hope this helps.

Avatar

Administrator

Hi @Silvio6,

Was the given solution helpful to resolve your query or do you still need more help here? Do let us know. In case the given solution was helpful, then kindly choose it as the 'Correct Reply'.

Thanks!



Sukrity Wadhwa