Sunday, October 29, 2023

Event Calendar Vanilla Javascript

        const numDays = (y, m) => new Date(y, m, 0).getDate();

        console.log(numDays(2023, 10));


        let dayone = new Date(2023, 9, 1).getDay();

        console.log(dayone+" hari pertama di bulan ini 0 untuk minggu");


        // get the last date of the month

        let lastdate = new Date(2023, 9 + 1, 0).getDate();

        console.log(lastdate+" tanggal terakhir bulan ini");


        // get the day of the last date of the month

        let dayend = new Date(2023, 9, lastdate).getDay();

        console.log(dayend+" nama hari terakhir selasa di bulan ini");


        // get the last date of the previous month

        let monthlastdate = new Date(2023, 9, 0).getDate();

        console.log(monthlastdate+" tanggal terakhir dari bulan sebelumnya");

No comments:

Post a Comment

Set Cookie dan Remove Cookie dengan php vanilla.js

< html lang = "en" > < head >     < meta charset = "UTF-8" >     < meta name = "viewport...