Expand my Community achievements bar.

Adobe Campaign User Groups are live now. Join our Adobe Campaign User Groups and connect with your local leaders!
SOLVED

Workflow activity

Avatar

Level 2

Hi, 

 

One simple question.

How to print Yesterday date in JavaScript code activity log.

 

Regards 

Abhishek

1 Accepted Solution

Avatar

Correct answer by
Level 9

One way to do it:

 

var d = new Date();
d.setDate(d.getDate()-1);
logInfo("Yesterdays date was: " + d.toLocaleString());

 


Output:
09/04/2020 13:24:33 js Yesterdays date was: Wed Apr 8 13:24:33 2020

Depending on what you need, you can refine the date format further using Javascript

View solution in original post

3 Replies

Avatar

Correct answer by
Level 9

One way to do it:

 

var d = new Date();
d.setDate(d.getDate()-1);
logInfo("Yesterdays date was: " + d.toLocaleString());

 


Output:
09/04/2020 13:24:33 js Yesterdays date was: Wed Apr 8 13:24:33 2020

Depending on what you need, you can refine the date format further using Javascript