Question: ```
 alert(new Date('2010-11-29'));

```

chrome, ff doesn't have problems with this, but safari cries "invalid date". Why ?

edit : ok, as per the comments below, I used string parsing and tried this : 

```
alert(new Date('11-29-2010')); //doesn't work in safari
alert(new Date('29-11-2010')); //doesn't work in safari
alert(new Date('2010-29-11')); //doesn't work in safari

```

**edit Mar 22 2018** : Seems like people are still landing here - Today, I would use `moment` or `date-fns` and be done with it. Date-fns is very much pain free and light as well.

Answer: 
To have a solution working on most browsers, you should create your date-object with this format

```
(year, month, date, hours, minutes, seconds, ms)

```

e.g.:

```
dateObj = new Date(2014, 6, 25); //UTC time / Months are mapped from 0 to 11
alert(dateObj.getTime()); //gives back timestamp in ms

```

works fine with IE, FF, Chrome and Safari. Even older versions.

[IE Dev Center: Date Object (JavaScript)](http://msdn.microsoft.com/en-us/library/ie/cd9w2te4%28v=vs.94%29.aspx)

[Mozilla Dev Network: Date](https://developer.mozilla.org/de/docs/JavaScript/Reference/Global_Objects/Date)
Though you might hope that browsers would support [ISO 8601](http://en.wikipedia.org/wiki/ISO_8601) (or date-only subsets thereof), this is not the case. All browsers that I know of (at least in the US/English locales I use) are able to parse the horrible US `MM/DD/YYYY` format.

If you already have the parts of the date, you might instead want to try using [Date.UTC()](http://objjob.phrogz.net/js/method/777). If you don't, but you must use the `YYYY-MM-DD` format, I suggest using a regular expression to parse the pieces you know and then pass them to `Date.UTC()`.