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

Workflow activity

Avatar

Avatar
Validate 1
Level 1
Abhishek_keshri
Level 1

Like

1 like

Total Posts

6 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
Abhishek_keshri
Level 1

Like

1 like

Total Posts

6 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
Abhishek_keshri
Level 1

08-04-2020

Hi, 

 

One simple question.

How to print Yesterday date in JavaScript code activity log.

 

Regards 

Abhishek

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 1
MVP
Darren_Bowers
MVP

Likes

78 likes

Total Posts

263 posts

Correct Reply

84 solutions
Top badges earned
Validate 1
Affirm 50
Establish
Give Back 3
Applaud 25
View profile

Avatar
Validate 1
MVP
Darren_Bowers
MVP

Likes

78 likes

Total Posts

263 posts

Correct Reply

84 solutions
Top badges earned
Validate 1
Affirm 50
Establish
Give Back 3
Applaud 25
View profile
Darren_Bowers
MVP

08-04-2020

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

Answers (0)