I have a date in milliseconds that I convert to a readable date. Then I hide it until the line so that I can break it and break it to use the parts I need. The problem is that when I break this space, it breaks each character by itself and does not break it where there is a space. Can someone explain why and what I am doing wrong?
here is my code:
var formattedDate = new Date(somedateMS);
var formattedDateSplit = formattedDate.toString();
formattedDateSplit.split(" ");
console.log(formattedDateSplit);
console.log(formattedDateSplit[0]);
console.log(formattedDateSplit[1]);
console.log(formattedDateSplit[2]);
console.log(formattedDateSplit[3]);
console.log(formattedDateSplit[4]);
console.log(formattedDateSplit[5]);
console.log(formattedDateSplit[6]);
How can I divide it so that I can get rid of the day of the week, and just so that on May 18, 2015 18:35:27 into 4 separate values? (May 18, 2015 6:35:27 PM)?
I have done this before and am not sure why this time he breaks it down by character.
Thank!
SS113 source
share