# adding days to a date value

**URL:** <https://forum.servoy.com/t/adding-days-to-a-date-value/2860>\
**Category:** Classic Servoy\
**Created:** [October 8, 2004, 1:03pm UTC](https://forum.servoy.com/t/adding-days-to-a-date-value/2860 "2004-10-08T13:03:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![faheemhameed](https://avatars.discourse-cdn.com/v4/letter/f/7ea924/32.png) [@faheemhameed](https://forum.servoy.com/u/faheemhameed)\
**Post date:** [October 8, 2004, 1:03pm UTC](https://forum.servoy.com/t/adding-days-to-a-date-value/2860/1 "2004-10-08T13:03:10Z")

</div>

Hi there,

I want to add days to a date value. Something like below.

```auto
form1.controller.newRecord();
form1.due_date = application.getServerTimeStamp + 14;

```

But it gives a strange number instead of the correct date value.  
Can any one please explain what I am doing wrong?

Thanks  
Hameed

---

<div class="post-metadata">

**Author:** ![maarten](https://avatars.discourse-cdn.com/v4/letter/m/ecccb3/32.png) [@maarten](https://forum.servoy.com/u/maarten)\
**Post date:** [October 8, 2004, 3:03pm UTC](https://forum.servoy.com/t/adding-days-to-a-date-value/2860/2 "2004-10-08T15:03:00Z")

</div>

Create a date object first…

```auto
var serverDate = application.getServerTimeStamp() // serverDate is a Date Object.
// you can now use the methods in the JSLib>Date node to manipulate the date object
// ".setDate(integer)" where integer is nr of days to add/subscract
// ".setMonth(integer)" where integer is nr of months to add/subscract
// etc....
serverDate.setDate( serverDate.getDate()+14) // add 14 days
form1.due_date = serverDate;

```

---

<div class="post-metadata">

**Author:** ![faheemhameed](https://avatars.discourse-cdn.com/v4/letter/f/7ea924/32.png) [@faheemhameed](https://forum.servoy.com/u/faheemhameed)\
**Post date:** [October 26, 2004, 3:30am UTC](https://forum.servoy.com/t/adding-days-to-a-date-value/2860/3 "2004-10-26T03:30:51Z")

</div>

Thanks!! Works like charm.
