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

18,078 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 by avibootz
...