Welcome to collectivesolver - Programming & Software Q&A. A website you can trust. All programs tested and work.

aviboots(AT)netvision.net.il

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

Bonsai Boy of New York Bonsai Trees and Accessories

Website Domains Names & Hosting | Domain.com

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

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

DreamHost Web Hosting


Liquid Web Cloud VPS Hosting

Disclosure We are a professional Programming & Software Q&A website, that receives compensation from some of the links whose we show you with Information. It means that my content may contain affiliate links.

13,237 questions

18,022 answers

573 users

How to create an array of dates in JavaScript

2 Answers

0 votes
let dates = []; 
          
dates.push(new Date("2020/03/20")); 
dates.push(new Date("2020/05/21")); 
dates.push(new Date("2020/01/13")); 
dates.push(new Date("2020/02/27")); 
dates.push(new Date("2020/05/20")); 

console.log(dates);
 
 
/*
run:
 
[
Fri Mar 20 2020 00:00:00 GMT+0200 (Israel Standard Time) ,
Thu May 21 2020 00:00:00 GMT+0300 (Israel Daylight Time) ,
Mon Jan 13 2020 00:00:00 GMT+0200 (Israel Standard Time) ,
Thu Feb 27 2020 00:00:00 GMT+0200 (Israel Standard Time) ,
Wed May 20 2020 00:00:00 GMT+0300 (Israel Daylight Time)
] 
 
*/

 




answered May 21 by avibootz
edited May 21 by avibootz
0 votes
let dates = ['2020/03/20', '2020/05/21', '2020/01/13', '2020/02/27', '2020/05/20']; 
          
console.log(dates);
 
 
/*
run:
 
 [
"2020/03/20" ,
"2020/05/21" ,
"2020/01/13" ,
"2020/02/27" ,
"2020/05/20"
] 

*/

 




answered May 21 by avibootz
...