Hi all,
i would like to inster something like "September 2018" into an E-Mail. This should/could a personalization block or directly as personalization into the email. The month and year should based on a date field with the following format: 2017/08/31 00:00:00.
I guess putting an javascript for the calculation and the return, but I could not create the correct syntax.
Many thanks and br
Robert
Solved! Go to Solution.
Views
Replies
Total Likes
Hi Robert,
You can use the following script to insert the date in the format you are looking for
<%
var monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", November", "December"];
var d = new Date();
document.write(monthNames[d.getMonth()] + " " + (d.getFullYear()));
%>
Hope this solves the issue you are facing,
Else please specify more narrow
Best Regards,
Jonas
Views
Replies
Total Likes
Hi Robert,
You can use the following script to insert the date in the format you are looking for
<%
var monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", November", "December"];
var d = new Date();
document.write(monthNames[d.getMonth()] + " " + (d.getFullYear()));
%>
Hope this solves the issue you are facing,
Else please specify more narrow
Best Regards,
Jonas
Views
Replies
Total Likes
Wow great...fter I set an additional " n fornt of november it works many thanks for that fast help!
Views
Replies
Total Likes
Hi Roberts,
Alternative way to mention, please see the standard Adobe Campaign JSAPI function formatDate().
It is recommended over standard Javascript function, it eases date manipulation, especially timezone management, locale language and default format or specific format.
Examples:
ctx.vars.datetime_day = formatDate(getCurrentDate(),"%4Y-%2M-%2D %02H:%02N:%02S")
in your case, the format to use is:
"%Bl %4Y"
So in case of English language, it generates "September 2018", but in case of French, it generates "septembre 2018" (without Smart Capitalization) automatically.
Regards.
J-Serge
Views
Replies
Total Likes
Hi Jean, okay that sounds plausible. I will test it as well.
Views
Replies
Total Likes
Views
Likes
Replies