Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Workflow activity

Abhishek_keshri
Level 2
Level 2

Hi, 

 

One simple question.

How to print Yesterday date in JavaScript code activity log.

 

Regards 

Abhishek

1 Accepted Solution
Darren_Bowers
Correct answer by
Community Advisor
Community Advisor

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
Darren_Bowers
Correct answer by
Community Advisor
Community Advisor

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