Hello i want to get current time as 00/00/0000 00:00:00 with javascript ?
00/00/0000 00:00:00
is it possible or must to use a library
Hello i want to get current time as 00/00/0000 00:00:00 with javascript ?
00/00/0000 00:00:00
is it possible or must to use a library
var date = new Date();
console.log(`${date.toLocaleDateString()} ${date.toLocaleTimeString()}`);
Plain JavaScript provides the Date() object which returns that information.
var date=new Date();
console.log(date);
If you want it to look exactly like
00/00/0000 00:00:00
you can format it yourself using this:
var date = new Date();
console.log(date.getDate() + "/" + (date.getMonth() + 1) + "/" + date.getFullYear() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds());