I'm trying to find the date one month ago from a specific date. But facing a strange problem.

```
var d = new Date(2009, 1, 25);
var dt = d.getDate();
var m = d.getMonth() - 1;  
var y = d.getFullYear();

if(m === 0) { 
    m = 12;
    y -= 1;
}

var numDays = new Date(y, m + 1, 0).getDate();

if(d.getDate() > numDays) {
    dt = 0;
}
console.log(y, m, dt); // 2008 12 25
var sd = new Date(y, m, dt);
console.log(sd.toString()); // Sun Jan 25 2009 00:00:00 GMT+0530 (IST)

```

While the first console is printing: `2008 12 25` properly, but the second log shows: `Sun Jan 25 2009 00:00:00 GMT+0530 (IST)`. How is this possible?

**Addition: More Detailed Question**

I'm not concerned about the formatting. I'm surprised why a different date object is created while I'm creating the date with the same variables I'm printing just above.