Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Prodentim Probiotics Specially Designed For The Health Of Your Teeth And Gums

Instant Grammar Checker - Correct all grammar errors and enhance your writing

Teach Your Child To Read

Powerful WordPress hosting for WordPress professionals

Disclosure: My content contains affiliate links.

31,153 questions

40,706 answers

573 users

How to get yesterday date in JavaScript

1 Answer

0 votes
const today = new Date();

const yesterday = new Date(today);
 
yesterday.setDate(yesterday.getDate() - 1);

console.log(yesterday.toDateString()); 




/*
run:

"Sun Nov 03 2019"


*/

 





answered Nov 4, 2019 by avibootz
edited Apr 10, 2022 by avibootz

Related questions

1 answer 58 views
1 answer 27 views
27 views asked Aug 11, 2023 by avibootz
3 answers 32 views
32 views asked Aug 11, 2023 by avibootz
3 answers 33 views
33 views asked Aug 10, 2023 by avibootz
1 answer 45 views
45 views asked Apr 10, 2022 by avibootz
...