I am tryign to use the following code:
{% let newDate = profile._loyaltyone.onboardingJourney.firstOffer.endDate %}
New Date = {%= newDate %}
which returns the following:
New Date = 2024-05-12T00:00:00Z
I would like to format as "May 12, 2024" but my code is not working:
New Date = {%= formatDate(newDate, "MMMM dd,YYYY") %}
Invalid syntax Usage of function "formatDate" does not match available signatures. Usage: [PQLSchemaImplJson({"meta:xdmType":"date"}), PQLSchemaImplJson({"meta:xdmType":"string"})] Signatures: [(List(PQLSchemaImplJson({"meta:xdmType":"date-time"}), PQLSchemaImplJson({"meta:xdmType":"string"})),PQLSchemaImplJson({"meta:xdmType":"string"})), (List(PQLSchemaImplJson({"meta:xdmType":"date-time"}), PQLSchemaImplJson({"meta:xdmType":"string"}), PQLSchemaImplJson({"meta:xdmType":"string"})),PQLSchemaImplJson({"meta:xdmType":"string"}))]
I know I am doing something wrong, just not sure what.
Solved! Go to Solution.
Views
Replies
Total Likes
You can try the following
{% let newDate = profile._loyaltyone.onboardingJourney.firstOffer.endDate %}
{%= formatDate(toDateTimeOnly(newDate), "LLLL dd, YYYY") %}
@connorSlack24 Try something along these lines,
{% let d=profile._loyaltyone.onboardingJourney.firstOffer.endDate %}
{% let m=getMonth(d)%}
{% let dispMonth=""%}
{%#if m=1 %}
{% let dispMonth="Jan"%}
{% else if m=2 %}
{% let dispMonth="Feb"%}
{% else if m=3 %}
{% let dispMonth="Mar"%}
{% else if m=4 %}
{% let dispMonth="Apr"%}
{% else if m=5 %}
{% let dispMonth="May"%}
{% else if m=6 %}
{% let dispMonth="Jun"%}
{% else if m=7 %}
{% let dispMonth="Jul"%}
{%/if%}
{{ dispMonth }} {%= formatDate(d, "dd, YYYY") %}
Views
Replies
Total Likes
This did not work for me, but the solution posted below did (we have found that toDateTimeOnly function AFTER I posted the help)
Views
Replies
Total Likes
You can try the following
{% let newDate = profile._loyaltyone.onboardingJourney.firstOffer.endDate %}
{%= formatDate(toDateTimeOnly(newDate), "LLLL dd, YYYY") %}
Worked, thank you!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies