# addDays doesn't work

**URL:** <https://community.make.com/t/adddays-doesnt-work/6784>\
**Category:** Questions\
**Created:** [January 16, 2023, 8:53am UTC](https://community.make.com/t/adddays-doesnt-work/6784 "2023-01-16T08:53:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martin](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/martin/32/736_2.png) [@Martin](https://community.make.com/u/Martin)\
**Post date:** [January 16, 2023, 8:53am UTC](https://community.make.com/t/adddays-doesnt-work/6784/1 "2023-01-16T08:53:05Z")

</div>

Hi,

I’ve got the formula

{{get(split(“Montag,Dienstag,Mittwoch,Donnerstag,Freitag,Samstag,Sonntag”; “,”); formatDate(toString( **now** ); “d”))}}

![Bildschirmfoto 2023-01-16 um 09.38.57](https://europe1.discourse-cdn.com/flex013/uploads/make/original/2X/c/c378f1e56147ed0bdae9919f2988d1aaf71129af.png)

and want to change it to  
{{get(split(“Montag,Dienstag,Mittwoch,Donnerstag,Freitag,Samstag,Sonntag”; “,”); formatDate(toString(**addDays(now; 6)**); “d”))}}

![Bildschirmfoto 2023-01-16 um 09.38.39](https://europe1.discourse-cdn.com/flex013/uploads/make/original/2X/0/0253ce731061d960cd77546742e27befd7fd2efe.png)

But somehow the day of the week doesn’t got shown …

 ![Bildschirmfoto 2023-01-16 um 09.39.29](https://europe1.discourse-cdn.com/flex013/uploads/make/original/2X/6/6252e9cc409f07885a6a4dca67a57018ff2b06e4.jpeg)

Why?  
What is it, what I don’t understand? 🤔

Thank you in advance and best regards  
Martin

---

<div class="post-metadata">

**Author:** ![Callinetic](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/callinetic/32/93482_2.png) [@Callinetic](https://community.make.com/u/Callinetic)\
**Post date:** [January 16, 2023, 9:23am UTC](https://community.make.com/t/adddays-doesnt-work/6784/2 "2023-01-16T09:23:07Z")

</div>

Hi @Martin,

Thank you for sharing your question and the formula you’re trying to modify. To debug this issue, it’s helpful to split the complete function and set the result as a variable. By checking the results of each function and the function descriptions, it’s easier to identify the problem.

From analyzing your formula, it appears that the issue is with the last variable, where you are trying to retrieve the current day of the week. From the documentation, it seems that Sunday is considered the first day of the week and it is indexed as 0. However, in your array of days in the week, the index starts with 1. This can be seen in the following image:

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/make/original/2X/3/399972bd6c1118376c523cbab2468c889dab4e79.png)  
 ![image](https://europe1.discourse-cdn.com/flex013/uploads/make/original/2X/e/e8c29f8f293b50cddf274705c42cfe9a7792d557.png)

To fix this issue, you should change the order of the days in the string so that Sunday is the first day, and add 1 to the result of the second parameter in the `get()` function. The updated formula should look like this:

```auto
{{get(split("Sonntag,Montag,Dienstag,Mittwoch,Donnerstag,Freitag,Samstag"; ","); sum(formatDate(toString(addDays(now; 6)); "d"); 1))}}

```

I also wrote an article on the topic of zero-based and one-based indexing in Make, which you might find helpful: [Mastering the slice function in Make: Understanding zero-based and one-based indexing](https://community.make.com/t/mastering-the-slice-function-in-make-understanding-zero-based-and-one-based-indexing/6646)

Please let me know if you have any further questions.

Glenn - [Callinetic](https://www.callinetic.be/)

---

<div class="post-metadata">

**Author:** ![Martin](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/martin/32/736_2.png) [@Martin](https://community.make.com/u/Martin)\
**Post date:** [January 16, 2023, 10:23am UTC](https://community.make.com/t/adddays-doesnt-work/6784/3 "2023-01-16T10:23:13Z")

</div>

Thank you Glenn,

It works and now I got an idea why  
{{formatDate(toString(addDays(now; 6)); “DD.”)}}  
had worked on the other side.  
Both formulas seemed to be similar – but in combination with a get-function I have to keep in mind that it is working with index.  
😊

Best regards  
Martin

---

<div class="post-metadata">

**Author:** ![Make\_Bot](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/make_bot/32/14661_2.png) [@Make\_Bot](https://community.make.com/u/Make_Bot)\
**Post date:** [September 7, 2023, 3:22pm UTC](https://community.make.com/t/adddays-doesnt-work/6784/4 "2023-09-07T15:22:34Z")

</div>


