Question: I am using **jquery datepicker** to select a date and convert to timestamp (epoch time). The script works arbitrarily. It shows timestamp for dates from 1st to 12th of any chosen month but makes time 12:00am of those days (I converted it online). But from 13th to the end of the month it shows **NAN** as timestamp. Strange enough when the date formated to dd/mm/yy all the days shows correctly.

```
$(function() {
    $("#datepicker").datepicker({dateFormat: 'dd-mm-yy',
        onSelect: function(dateText, inst) {
              var dtV = $(this).val();
              var d = new Date(dtV);
              var s = parseInt((d)/1000);
              $("#selectedDate").text("on " + dateText + "");
              $(".selectedDate2").text(s.valueOf());
        }
    });
});

```

Answer: 
Following works for me. Just added a **ui-datepicker** class:

```
$(function () {
        $("#txtStartDate").datepicker();
        $('.ui-datepicker').addClass('notranslate');
    });

```
It's interpreting your format as if it's `mm-dd-yy`; JavaScript's native `Date` class assumes all string input in the format `\d\d[-/]\d\d[-/]\d\d` is `mm-dd-yy`. 

The `yyyy-mm-dd` format [ISO 8601](http://en.wikipedia.org/wiki/ISO_8601) is more common and should be interpreted correctly.