Is there a way to convert the long date format from "Sat Dec 13 2014 06:00:00 GMT+0600" to "2014-12-13" in yyyy-mm-dd format?
<script>
function myDate(val)
{
var now = new Date("<?php echo $Cnextdue;?>");
now.setDate(now.getDate() + 30*val);
document.getElementById("txtnextdue").value=now;
}
</script>
The current result in the text box is "Sat Dec 13 2014 06:00:00 GMT+0600"
How can I modify it to display as "2014-12-13"?