Announcements
Hi Forum,
i have a gallery with some items (it comes from SP List). Every item has a startdate and an enddate.
How can i count the days between start an enddate?
I need the days for all items in the gallery and not for one item.
Thanks 😉
Depends what you need exactly but something like this (this is for the time)Add a text field inside of the gallery and as text write Text(ThisItem.EndDate;"hh,mm")-Text(ThisItem.StartDate;"hh,mm")
Hi @Tamer66 ,
Insert a label control inside your Gallery
Enter the following code:
DateDiff( StartDate, EndDate, TimeUnit.Days )
Replace your items in above syntax and you will get days for each records displayed in Gallery
Hope this helps
I undestand the DateDiff Function but how can i count the diff for all records at once?
eg.
Record 1: datediff=2
Record 2: datediff=4
Label for count: 6 Days
Can you be more specific? You want to calculate the difference between StartDate and EndDate and then sum all the records or something else?
Reference Blog
Now, since this is a label control, you need to check if you're getting Label in the syntax.
Sum(Gallery1.AllItems, lblDateDiff.Text) //OR Sum(Gallery1.AllItems, Value(lblDateDiff.Text))
Exactly, i need the sum (days) of all records.
i can show the difference of the date in days with DateDiff() for one record, but what i need ist the sum (days) of all records
you can do the DateDiff inside of the gallery for each record when the end date is entered and patch the DateDiff record to the sharepoint and then do the Sum(Gallery1.AllItems, Value(NameoftheDifffield.text))
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
Congratulations to our community stars!
Expanding mentorship, skilling, and AI innovation
These are the community rock stars!
Stay up to date on forum activity by subscribing.
11manish 354 Super User 2026 Season 2
M Bilal Khan 330
Mohsin Ali 232