I have this date format:
"Mon Jun 5 00:00:00 UTC-04:00 2017"
How can I convert it to any human-readable format?
I have this date format:
"Mon Jun 5 00:00:00 UTC-04:00 2017"
How can I convert it to any human-readable format?
Depending on what format you want you can use the JavaScript Date object. Documentation of other methods found here.
let date = new Date("Mon Jun 5 00:00:00 UTC-04:00 2017");
console.log(date.toString());
console.log(date.toDateString());
console.log(date.toLocaleString());
console.log(date.toLocaleDateString());
console.log(date.toUTCString());
I hope this helps
var str = "Mon Jun 5 00:00:00 UTC-04:00 2017";
var date = new Date(str);
console.log(date);
var year = date.getFullYear();
var month = date.getMonth();
var day = date.getDate();
var hour = date.getHours();
var minutes = date.getMinutes();
var seconds = date.getSeconds();
var output = `Year: ${year}/${month}/${year} Time: ${hour}:${minutes}:${seconds}`;
console.log(output);