ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
``` let d1 = new Date() let year = d1.getFullYear(); let mon = d1.getMonth(); let day = d1.getDate(); let hour = d1.getHours(); //得到小时数 let minute = d1.getMinutes() ; //得到分钟数 let second = d1.getSeconds(); //得到秒数 let date = year + "-" + (mon < 10 ? "0" + (mon+1) : mon ) + "-" + (day < 10 ? "0" + day : day ); let time = (hour < 10 ? "0" + hour :hour) + ":" + (minute < 10 ? "0" + minute : minute ) + ":" + (second < 10 ? "0" + second : second ); // 设置日期、时间 this.setData({"node2Date" : date,"node2Time" : time,}); ```