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,128 questions

40,777 answers

573 users

How to create date object in JavaScript

1 Answer

0 votes
let d1 = new Date(); 
let d2 = new Date(2020, 5, 19); 
let d3 = new Date('2020-05-19'); 
let d4 = new Date(2020, 5, 13, 10, 42, 33);
let d5 = new Date(999999930000);
let d6 = new Date("May 13, 2020 16:53:00");

console.log(d1); 
console.log(d2); 
console.log(d3); 
console.log(d4); 
console.log(d5); 
console.log(d6); 

 
/*
run:
 
Wed May 20 2020 16:53:14 GMT+0300 (Israel Daylight Time)
Fri Jun 19 2020 00:00:00 GMT+0300 (Israel Daylight Time)
Tue May 19 2020 03:00:00 GMT+0300 (Israel Daylight Time)
Sat Jun 13 2020 10:42:33 GMT+0300 (Israel Daylight Time)
Sun Sep 09 2001 04:45:30 GMT+0300 (Israel Daylight Time)
Wed May 13 2020 16:53:00 GMT+0300 (Israel Daylight Time)
 
*/

 





answered May 20, 2020 by avibootz

Related questions

1 answer 80 views
1 answer 62 views
1 answer 73 views
...