I\'m trying to get the current date without the time and store it in a variable, within JavaScript. It needs to be without time as I\'m converting it to an epoch date, with
Try this:
function dateToEpoch(thedate) { var time = thedate.getTime(); return time - (time % 86400000); }
or this:
function dateToEpoch2(thedate) { return thedate.setHours(0,0,0,0); }
Example : http://jsfiddle.net/chns490n/1/
Reference: (Number) Date.prototype.setHours(hour, min, sec, millisec)