cancel
Showing results for
Did you mean:
Anonymous
Not applicable

Adding to sharepoint based on Day/Night Shift

So, I have created an app where users can input their team's data based on the day and whether it is day/night shift.

Assuming we want the 19th August

Day Shift is defined as: 5:30 am (19th) - 5 : 30 pm (19th)

Night Shift is defined as: 5:30 pm (19th)  - 5:30 am (20th)

Currently, users can input properly during day shift. For night shift, users can input up to 11:59 pm of the 19th. When the time switches to 12:00 pm the text label shows: August 20th - Night Shift which should actually be August 19th - Night Shift.

I realize now that that's what the above code written is intended to do. Is there a way I can change this to shift the night shift back one day. So, if it is 12:00 am - 5:30 am on the 20th it should actually be Night Shift for the 19th.

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support

Hi @Anonymous ,

Do you want this:
1)if current time is 5:30 am (19th) - 5 : 30 pm (19th), then you will return: today()+Day Shift

2)if current time is 5:30 pm (19th)  - 23:59:59 am (19th), then you will return: today()+Night Shift

3)if current time is 12:00 pm (20th)  - 5:30 am am (20th), then you will return: today()-1+Night Shift

Could you tell me:
1)whether 5:30 am (19th)  is 19th Day Shift   or 18th Night Shift?

2)whether 5:30 pm(19th) is 19th Day Shift   or 19th Night Shift?

I assume that: 5:30 am (19th) is 19th Day Shift

5:30 pm(19th) is 19th Night Shift .

If so, try this formula:

``````If(
TimeValue(Text(Now()))>=Time(5,30,0)&&TimeValue(Text(Now()))<Time(17,30,0),
Today()&" Day Shift",
TimeValue(Text(Now()))>=Time(17,30,0)&&TimeValue(Text(Now()))<=Time(23,59,59),
Today()&" Night Shift",
TimeValue(Text(Now()))>=Time(0,0,0)&&TimeValue(Text(Now()))<Time(5,30,0),
)``````

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 REPLIES 2
Community Support

Hi @Anonymous ,

Do you want this:
1)if current time is 5:30 am (19th) - 5 : 30 pm (19th), then you will return: today()+Day Shift

2)if current time is 5:30 pm (19th)  - 23:59:59 am (19th), then you will return: today()+Night Shift

3)if current time is 12:00 pm (20th)  - 5:30 am am (20th), then you will return: today()-1+Night Shift

Could you tell me:
1)whether 5:30 am (19th)  is 19th Day Shift   or 18th Night Shift?

2)whether 5:30 pm(19th) is 19th Day Shift   or 19th Night Shift?

I assume that: 5:30 am (19th) is 19th Day Shift

5:30 pm(19th) is 19th Night Shift .

If so, try this formula:

``````If(
TimeValue(Text(Now()))>=Time(5,30,0)&&TimeValue(Text(Now()))<Time(17,30,0),
Today()&" Day Shift",
TimeValue(Text(Now()))>=Time(17,30,0)&&TimeValue(Text(Now()))<=Time(23,59,59),
Today()&" Night Shift",
TimeValue(Text(Now()))>=Time(0,0,0)&&TimeValue(Text(Now()))<Time(5,30,0),
)``````

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

So, I did something very similar to you with my original format. I was just confused at the beginning on how to shift the date to the previous day but I see that can be done with DateAdd(Today(),-1.. and so on .

Announcements

Celebrating the May Super User of the Month: Laurens Martens

@LaurensM  is an exceptional contributor to the Power Platform Community. Super Users like Laurens inspire others through their example, encouragement, and active participation. We are excited to celebrated Laurens as our Super User of the Month for May 2024.   Consistent Engagement:  He consistently engages with the community by answering forum questions, sharing insights, and providing solutions. Laurens dedication helps other users find answers and overcome challenges.   Community Expertise: As a Super User, Laurens plays a crucial role in maintaining a knowledge sharing environment. Always ensuring a positive experience for everyone.   Leadership: He shares valuable insights on community growth, engagement, and future trends. Their contributions help shape the Power Platform Community.   Congratulations, Laurens Martens, for your outstanding work! Keep inspiring others and making a difference in the community!   Keep up the fantastic work!

Announcing Power Apps Copilot Cookbook Gallery

We are excited to share that the all-new Copilot Cookbook Gallery for Power Apps is now available in the Power Apps Community, full of tips and tricks on how to best use Microsoft Copilot as you develop and create in Power Apps. The new Copilot Cookbook is your go-to resource when you need inspiration--or when you're stuck--and aren't sure how to best partner with Copilot while creating apps.   Whether you're looking for the best prompts or just want to know about responsible AI use, visit Copilot Cookbook for regular updates you can rely on--while also serving up some of your greatest tips and tricks for the Community. Check Out the new Copilot Cookbook for Power Apps today: Copilot Cookbook - Power Platform Community.  We can't wait to see what you "cook" up!