Hi Team,
We are trying to populate the dynamic offer end date in email creative base on journey run date + 30 days in specific format.
Did anyone can help me on the same? I can populate the date (2023-07-02) but want in MM/DD/YYYY format
Solved! Go to Solution.
You can use the formatDate function to display the date format as MM/DD/YYYY.
{% let d=now %}
{%= formatDate(d, "mm/dd/YYYY") %}
You can use the formatDate function to display the date format as MM/DD/YYYY.
{% let d=now %}
{%= formatDate(d, "mm/dd/YYYY") %}
Thanks, similar type of syntax is working for me in email body.
Want to utilize in the SMS but it is not working.
Updating the offer end date ( now + 30days) in datetime column
same column passing in the SMS attributes and want date format mm/dd/yy but it is not working.
Views
Replies
Total Likes
@SatheeskannaK
It is also working for me:
{% let d=now %}
{%= formatDate(d, "mm/dd/YYYY") %}
But I need to add +7 days. That is not working. addDates or addDays function does not work. I have tried set days
{% let d = today %}
{%= formatDate(setDays(d,7), "D/MM/YYYY") %}
But it gives wrong output like 217/08/2023
Could you please help?
@ST_questions
Have you found any solution? If yes, could you please share it?
Views
Replies
Total Likes
@Zahid_14, Try this,
{% let d = today %}
{% let m=getMonth(d) %}
{% let d1=d.getDayOfMonth()+7 %}
{{ dispMonth }} {{ d1 }} {%= formatDate(d, "YYYY") %}
I haven't tried this yet. I think there is a flaw irrespective of the day it will add 7 days. For example, if today is 25 then it will become 32.
If you find any other solution let me know.
Views
Replies
Total Likes
@SatheeskannaK
Thank you so much. I have tried this with 10 days just to see. You are right. In that case it shows 32 :'(
Still searching for the solution
Views
Replies
Total Likes
@SatheeskannaK
At last I have found the solution:
{% let d2 = currentTimeInMillis() + 14*86400000 %}
{% let ourDate = toDateTimeOnly(d2) %}
{%= formatDate(ourDate, "dd/MM/yyyy") %}
@Zahid_14 Thanks for sharing this👍. Consider displaying the formatted date according to the profile timezone if it's something you're interested in.
Views
Replies
Total Likes
@SatheeskannaK
Just to let you know that my code only works up to 20 days. For more than 20 days, it shows wrong date 😞
Do you have any idea or are you aware of any new updates from Adobe?
Views
Replies
Total Likes
@SatheeskannaK
Thank you so much. Here is the code used and output:
{% let d2 = currentTimeInMillis() + 15*86400000 %}
{% let ourDate = toDateTimeOnly(d2) %}
{%= formatDate(ourDate, "dd/MM/yyyy") %}
output: 18/04/2024
-------
{% let d2 = currentTimeInMillis() + 30*86400000 %}
{% let ourDate = toDateTimeOnly(d2) %}
{%= formatDate(ourDate, "dd/MM/yyyy") %}
output: 14/03/2024
Views
Replies
Total Likes
But I think it is not problem of Adobe, as if I convert 30 days in mills, it shows like this (https://currentmillis.com/)
Views
Replies
Total Likes
Found some solution. Instead of using 30*86400000, multiple these values 30*86400000 = 2592000000. Below is code.
{% let d2 = currentTimeInMillis() + 2592000000 %}
{% let ourDate = toDateTimeOnly(d2) %}
{%= formatDate(ourDate, "dd/MM/yyyy") %}
Views
Replies
Total Likes