You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.
View groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
I am trying to display duration column with difference between 2 dates in Confluence. I have tried below:
select *,(CAST(ROUND(ceiling(DATEDIFF(DAY,'From Date','To Date')))as int))+1+ " days" as 'Duration' from T1
this gives the result, however given the dates 25-Jun-2020 to 26-Jun-2020 - duration displayed as 1 instead of 2.
your help is appreciated here. thanks.
Hi @Gireesha Jeera, I used your query in the Table Transformer macro and it works as expected:
What version of Table Filter and Charts do you use?
Did you set the correct date format dd-M-yy in the macro settings?
Hi @Andrey Khaneev _StiltSoft_ ,
Thanks for the quick response, in my case table looks as below:
for me this still displayed as 1 days, can you please help here ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Also @Andrey Khaneev _StiltSoft_ it works may be because i have added + 1 for the below query. however this query doesnt work if there are blank dates and displayed as 1 days.
select *,(CAST(ROUND(ceiling(DATEDIFF(DAY,'From Date','To Date')))as int))+1+ " days" as 'Duration' from T1
so try this and let me know, thank you.
select *,(CAST(ROUND(ceiling(DATEDIFF(DAY,'From Date','To Date')))as int))+ " days" as 'Duration' from T1
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Strange... Could you try this query:
select *,('To Date' - 'From Date' + "1d") / "1d" + " days" as 'Duration' from T1
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Your second query outputs "1 days" for the same dates.
select *,(CAST(ROUND(ceiling(DATEDIFF(DAY,'From Date','To Date')))as int))+ " days" as 'Duration' from T1
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
this query gives output of 4.428571428571429 days in Duration column. instead of day in whole number format (should be 2 days) thank you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
select *,('To Date' - 'From Date' + "24h") / "24h" + " days" as 'Duration' from T1
Please, try this. By default "1d" equals to 8 hours (working day). You can change it in the Worklog settings:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Andrey Khaneev _StiltSoft_ Perfect works mate, thank you.
is there any solution to exclude weekends while calculating the number of days between the dates using SQL query ?
Thank you once again mate :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Glad to help you!
Yes, it is possible, but the query is quite complex. See the docs. Let me know if you have any questions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Andrey Khaneev _StiltSoft_ sorry to trouble you again,
i have tried between the dates 19 Oct 2020 to 30 Oct 2020, its results in 12.041666666666666 days
can you help here to round off please ?
i am using below query currently:
select *,('To Date' - 'From Date' + "24h") / "24h" + " days" as 'Duration' from T1
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Gireesha Jeera, that's because of one extra hour due to daylight saving time. Please, ROUND the calculated value:
select *,ROUND(('To Date' - 'From Date' + "24h") / "24h") + " days" as 'Duration' from T1
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks @Andrey Khaneev _StiltSoft_ it worked for the number of days but for empty values of both from date and date displayed as "NaN days"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please, use this query:
select *,
CASE WHEN T1.'To Date' IS NOT NULL AND T1.'From Date' IS NOT NULL THEN
ROUND(('To Date' - 'From Date' + "24h") / "24h") + " days"
ELSE "" END
as 'Duration' from T1
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Community! We're thrilled to share that Team Calendars for Confluence is now a built-in feature for Confluence Data Center releases 7.11 and beyond. A long time favorite, Team Cale...
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.