Question: I am trying to parse a date string to javascript timestamp, the format of the string is `2013-01-01 12:00 AM` but when I attempt to alert the output all I can get is `NaN` My attempt is:

```
var ts_begin = Date.parse($('#fromdate').val()+' '+$('#fromtime').val());
alert(ts_begin);

```

Answer: 
The [`parse()`](https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/parse) method is very picky on what date formats it accepts. You may want to look at another JavaScript library called [Moment.js](http://momentjs.com/) to parse your dates (it can also do a lot more with date/time values).
```
var utc_timestamp = Date.UTC(now.getFullYear(),now.getMonth(), now.getDate(), 
    now.getHours(), now.getMinutes(), now.getSeconds(), now.getMilliseconds());
alert(utc_timestamp);

```