timestamp get datetime

                var today = new Date(time * 1000);

                //date

                console.log(today);

                var DD = String(today.getDate()).padStart(2, '0'); // get day

                var MM = String(today.getMonth() + 1).padStart(2, '0'); //Get the month, January is 0

                var yyyy = today.getFullYear(); // Get the year

                // time

                hh = String(today.getHours()).padStart(2, '0'); //Get the current hour (0-23)

                mm = String(today.getMinutes()).padStart(2, '0'); //Get the current minute (0-59)

                ss = String(today.getSeconds()).padStart(2, '0'); //Get current seconds (0-59)

Guess you like

Origin blog.csdn.net/weixin_51412569/article/details/129952575