जावास्क्रिप्ट में दिन का अंत
आइए वर्तमान दिन के अंत वाली तारीख वाली एक वस्तु प्राप्त करें:
let now = new Date();
let date = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59);
वर्तमान दिन का अंत अगले दिन की आधी रात
(1 सेकंड का अंतर) माना जा सकता है:
let now = new Date();
let date = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1, 0, 0, 0);
जैसा कि आप जानते हैं, इस मामले में शून्य को छोड़ा जा सकता है:
let now = new Date();
let date = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1);
वैसे, आधी रात वर्तमान दिन का
24:00:00 समय भी होगा:
let now = new Date();
let date = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 24, 0, 0);
शून्य को छोड़ दें:
let now = new Date();
let date = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 24);
निर्धारित करें कि दिन के अंत तक कितने घंटे शेष हैं।