data time java script code example Example: Get data and time in javascript var date_time = new Date().toLocaleString(); console.log(date_time);