18
rated 0 times
[
23]
[
5]
/ answers: 1 / hits: 42494
/ 10 Years ago, tue, july 15, 2014, 12:00:00
I'm working with a string of data in this format: mm-dd-yy. I convert this to a Date object in this way:
var dateData, dateObject, dateReadable, dateSplit, year, month, day;
dateData = 07-21-14; //For example
dateSplit = dateData.split('-');
month = dateSplit[0] - 1;
day = dateSplit[1];
year = 20 + dateSplit[2];
dateObject = new Date(year, month, day);
dateReadable = dateObject.toUTCString(); //Returns Mon, 21 Jul 2014 04:00:00 GMT
I would like to return the date (Mon, 21 Jul 2014) without the time (04:00:00 GMT). Is there a different method that will do so? Or a way of calling .toUTCString()
to return the date without the time?
More From » date