cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
goel_gagandeep
Resolver I
Resolver I

How I can get the dates which are lying between the from date and To date

Hi Everyone, Actually I am working on leave app(canvas app) in which I have made a custom calendar, on that calendar I want to show the applied leave's  Sessions Label name: for example
If a user is taking leave from 01-08-2022, Session1 (from date) to 03-08-2022, Session 1((To date) the number of days will count as 2.5 days ,
01-08-->01-08=1 day (Full day leave) S1-S2
02-08-->02-08=2 days (full day leave)S1-S2
03-08-->03-08=0.5 day (half day leave)S1-S1 
total days=2.5
here S1 And S2 are just working as AM and PM
Basically I just want the dates which are lying between the from date and To date
on calendar I just want show these Sessions names(S1-S2) as per the requirement, I have also attached the pics for the reference I hope it will give you some help for understanding.
Thanks. 

4 REPLIES 4
Roverandom
Solution Supplier
Solution Supplier

Do you want to know how many days there are between StartDate and EndDate? If so, use the DateDiff function:

DateDiff(StartDate, EndDate, Days)


Hi! I hope I was helpfull. Please always mark the answer that helped you, so others who need it will find it faster.



Roverandom is a book by J.R.R Tolkien. I'm a big fan of his works and as Frodo, Aragorn or Gollum are already widely used, I decided to use this nickname.

Thanks @Roverandom for your response, but my scenario is different so this code is not suitable for my requirement

 

v-jefferni
Community Support
Community Support

Hi @goel_gagandeep ,

 

To get dates between two dates, you can use below approach:

Collect(colDates, ForAll(Sequence(DateDiff(FromDate, ToDate),0),AddDays(FromDate, ThisRecord.Value))

 

The issue is, if there were weekends lay between from and to dates, you need to exclude them, which will make the situation complicated.

 

Best regards,

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

Hi @v-jefferni , first of all thanks for the response Basically I want this

 

goel_gagandeep_0-1661143247890.png

 

As you seen above mentioned picture i.e. the table(LeaveHistory) record's Pic ,
In record pic I have applied for the leave 1/8/2022(from_date)(Session1)-3/8/2022(to_date)(session2) Basically I just want to break this record into three entries for example:
01-08-->01-08=1 day (Full day leave) S1-S2
02-08-->02-08=2 days (full day leave)S1-S2
03-08-->03-08=0.5 day (half day leave)S1-S1 
Here, S1= Session1& S2= Session2
I hope you all now understand my problem, so is there any way to split the record as per the requirement.
Thanks.

Is that possible?

Helpful resources

Announcements
Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Government Carousel

New forum: GCC, GCCH, DoD - Federal App Makers (FAM)

In response to the unique and evolving requirements of the United States public sector, Microsoft has created Power Apps US Government.

Users online (4,977)