Question: So I'm trying to add a certain number of days to a date, and I'm getting a strange issue:

```
var date = new Date();

var newdate = date.getDate() + $('#ddlDays option:selected').val();

date.setDate(newdate);

```

So if today is 09/29/2010, the Date is 29. But if a user selects "5" from ddlDays, it will assume I am adding strings together, adding 295 days to my date.

I was under the impression that javascript would assume they were integers? Does getDate() return a string instead of an integer?

How can I fix this?

Answer: 
It is `.val()` that is returning a String. You can use `.parseInt()` to convert to a Number.

```
var newdate = date.getDate() + 
                      (parseInt($('#ddlDays option:selected').val(), 10) || 0);

```

or

```
var newdate = date.getDate() + ~~$('#ddlDays option:selected').val();

```
Surround your string value with parseInt. JavaScript will concatenate strings to numbers (see <http://www.hunlock.com/blogs/The_Complete_Javascript_Number_Reference> for a thorough run through.)

This should do the trick:

```
var newdate = date.getDate() + parseInt($('#ddlDays option:selected').val());

```

or 

```
var newdate = date.getDate() + parseInt($('#ddlDays option:selected').val(), 10);

```