# How to add days to a date in JavaScript

> Learn how to add days to a Date object in JavaScript by combining the setDate() and getDate() methods to get a date like 30 days from now.

Author: [Flavio Copes](https://flaviocopes.com/about/) | Published: 2022-04-09 | Topics: [JavaScript](https://flaviocopes.com/tags/js/) | Canonical: https://flaviocopes.com/how-to-add-days-date-javascript/

Working with dates in [JavaScript](https://flaviocopes.com/javascript/) is always kind of fun. I wrote on this topic countless times, but there's always more to learn.

> Make sure you check out my [JavaScript Dates Guide](https://flaviocopes.com/javascript-dates/)

Today I have the solution to this problem: you have a Date object in JavaScript, and you want to add some days to it.

How do you do that?

Here is a date that represents **today**:

```js
const my_date = new Date()
```

Suppose we want to get the date that's "30 days from now".

We use the `setDate()` and `getDate()` methods, in this way:

```js
my_date.setDate(my_date.getDate() + 30)
```

![How to add days to a date in JavaScript](https://flaviocopes.com/images/how-to-add-days-date-javascript/Screen_Shot_2022-04-09_at_14.16.14.png)
