const now = new Date(); const date = now.toLocaleDateString(); const time = now.toLocaleTimeString(); console.log(date); // "3/5/2023" console.log(time); // "10:00:00 AM"(根据实际时间返回值不同)