Calculating dates from a start date
Asked by sian hamer:

I currently create a confluence page per software release by copying the previous release page. The start / end dates for each task is essentially a start date + n days.

Is there any way to calculate this automatically? ie setting the start date and the page calculates all the following dates?

I am not particularly technical, so if anyone knows a simple solution it would be great.

Thanks


Answers:
author: Courtney Langdon
body: I would like this ability, too. I'm trying to convince a group of users to utilize Confluence instead of Excel for their project information, but not being able to calculate future dates based on a start date in Confluence (especially when Excel can) is a deal breaker for them. :(

Any work-arounds? Potential future release?

Thanks!


author: Andrey Khaneev _StiltSoft_
body: This can be done with [Table Transformer](https://docs.stiltsoft.com/display/TableFilter/How+to+use+Table+Transformer+macro?src=contextnavpagetreemode) macro ([Table Filter and Charts](https://marketplace.atlassian.com/apps/27447/table-filter-and-charts-for-confluence?hosting=server&tab=overview) app). Here is example:

1. The source table ![2019-09-16_10h08_28.png](https://community.atlassian.com/t5/image/serverpage/image-id/66309i6C40990F9EDE774D/image-size/large?v=v2&px=999 "2019-09-16_10h08_28.png")
2. Adding the Table Transformer macro ![2019-09-16_10h09_41.png](https://community.atlassian.com/t5/image/serverpage/image-id/66310i9B91811E521F9EEF/image-size/large?v=v2&px=999 "2019-09-16_10h09_41.png")
3. Add this query ![2019-09-16_10h14_58.png](https://community.atlassian.com/t5/image/serverpage/image-id/66305i3627B66399091C9E/image-size/large?v=v2&px=999 "2019-09-16_10h14_58.png")

```
SELECT *, 
(T1.'Start Date' + "5d")::Date->toLocaleDateString() AS 'End Date' 
FROM T1
```

4. Ensure that there are 24 hours in day are set ![2019-09-16_10h17_48.png](https://community.atlassian.com/t5/image/serverpage/image-id/66306iA07497C3B833D973/image-size/large?v=v2&px=999 "2019-09-16_10h17_48.png")5. Get the result ![2019-09-16_10h21_12.png](https://community.atlassian.com/t5/image/serverpage/image-id/66308i665D747CBD40A6DF/image-size/large?v=v2&px=999 "2019-09-16_10h21_12.png")The calculated date can be formatted in different ways if needed.

comments: author: Andrey Khaneev _StiltSoft_
body: Something wrong with two first screenshots. Here they are

![2019-09-16_10h08_28.png](https://community.atlassian.com/t5/image/serverpage/image-id/66311iAF055A0AC0DB6046/image-size/large?v=v2&px=999 "2019-09-16_10h08_28.png")![2019-09-16_10h09_41.png](https://community.atlassian.com/t5/image/serverpage/image-id/66312i27919AE83F905E1E/image-size/large?v=v2&px=999 "2019-09-16_10h09_41.png")


author: erzn
body: Hi [@Andrey Khaneev _StiltSoft_](/t5/user/viewprofilepage/user-id/781696) ,

is it possible to take time format as like: MMMM d, yyyy as Start Date?

I used the correct pattern in "Settings" as i got the pattern.

My Data:

![Anmerkung 2020-04-22 145101.png](https://community.atlassian.com/t5/image/serverpage/image-id/91667i3F045C4626A6BD29/image-size/large?v=v2&px=999 "Anmerkung 2020-04-22 145101.png")


author: Andrey Khaneev _StiltSoft_
body: Hi [@erzn](/t5/user/viewprofilepage/user-id/3250132),

Please, set the date format to M dd, yy in the macro settings (for dates like Apr 16, 2020).


author: erzn
body: Hi [@Andrey Khaneev _StiltSoft_](/t5/user/viewprofilepage/user-id/781696) thanks for your quick response!

I still get invalid Date as a result:

![Anmerkung 2020-04-22 150641.png](https://community.atlassian.com/t5/image/serverpage/image-id/91673i9DB6237567FD9879/image-size/large?v=v2&px=999 "Anmerkung 2020-04-22 150641.png")![Anmerkung 2020-04-22 150815.png](https://community.atlassian.com/t5/image/serverpage/image-id/91674iB29EB964407BE93A/image-size/large?v=v2&px=999 "Anmerkung 2020-04-22 150815.png")


author: Andrey Khaneev _StiltSoft_
body: Strange, I tried to reproduce the issue, but it works in both English and German languages. Maybe you are using an outdated version of the Table Filter and Charts app. Could you try to update it?


author: erzn
body: Unfortunately not.

Maybe it has something to do with the fact that the source data comes in from the Jira macro? The data is pulled in regularly via the Jira macro and the table is then included within the transformer app.


author: Andrey Khaneev _StiltSoft_
body: Please, contact [StiltSoft support,](https://stiltsoft.customercase.com/forums/support-requests/ideas/create?category=Table%20Filter%20and%20Charts%20for%20Confluence) it will be easier to resolve the issue there.


author: Etienne Daloze
body: [@Andrey Khaneev _StiltSoft_](/t5/user/viewprofilepage/user-id/781696) , thanks for sharing your knowledge.

I have something similar:

* I have a report on the state of the pages of my space (via Document States Report macro)
* Most of the pages have a Comala workflow with a validity period. This validity period is defined via a page property (called *Validity*) following ISO8601 P3M style
* I would like to add to the report 2 columns :
  * *stale date* (=updated + *Validity*)
  * remaining days till stale date = stale date - today

Following what you share here, I've tried to add 3 months --\>

```
SELECT *, 
(T1.'Updated' + "3M")::Date->toLocaleDateString() AS 'stale date' 
FROM T1
```

I think that I may calculate the "3M" value by eliminating the P at the beginning of the *Validity*page property - if I can get that value; that's another story.

If I add "5d" like in your example, I get something. If I add "3m", it adds 3 minutes.

But if I had "3M", I get the "Invalid Date" result. How do I add months to a date?

Thanks for your help.

Yours,

Etienne


author: Katerina Rudkovskaya [Stiltsoft]
body: Hi [@Etienne Daloze](/t5/user/viewprofilepage/user-id/5134398),  

If I understand your question right, you have smth like this in your report:  

![Tue 18-1.png](https://community.atlassian.com/t5/image/serverpage/image-id/242851i0C1291E46139DE07/image-size/large?v=v2&px=999 "Tue 18-1.png")  

You may use the following solution for the case:  

![Tue 18-2.png](https://community.atlassian.com/t5/image/serverpage/image-id/242852i8C4FEE6CBDD8FDC1/image-size/large?v=v2&px=999 "Tue 18-2.png")  

SELECT \*,  
DATEDIFF(day, "today", 'Stale Date') AS 'Remaining days till stale date'  
FROM (SELECT \*,  
FORMATDATE(DATEADD(month, (SUBSTRING('Validity', 2, 1)::number), 'Updated')) AS 'Stale Date'  
FROM T\*)  

![Tue 18-3.png](https://community.atlassian.com/t5/image/serverpage/image-id/242853iD6AA941E1B2BD97E/image-size/large?v=v2&px=999 "Tue 18-3.png")  

Hope it helps.


Tags: calculated-field

date

filter

table

table-filter

table-filter-and-charts

table-transformer

template