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

Take a short Community User Survey | Help us make your experience better!

To ensure that we are providing the best possible experience for Community members, we want to hear from you!    We value your feedback! As part of our commitment to enhancing your experience, we invite you to participate in a brief 15-question survey. Your insights will help us improve our services and better serve the community.   👉 Community User Survey    Thank you for being an essential part of our community!    Power Platform Engagement Team

Tuesday Tip | How to Get Community Support

It's time for another Tuesday Tip, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.       This Week: All About Community Support Whether you're a seasoned community veteran or just getting started, you may need a bit of help from time to time! If you need to share feedback with the Community Engagement team about the community or are looking for ways we can assist you with user groups, events, or something else, Community Support is the place to start.   Community Support is part of every one of our communities, accessible to all our community members.   Within each community's Community Support page, you'll find three distinct areas, each with a different focus to help you when you need support from us most. Power Apps: https://powerusers.microsoft.com/t5/Community-Support/ct-p/pa_community_support Power Automate: https://powerusers.microsoft.com/t5/Community-Support/ct-p/mpa_community_support Power Pages: https://powerusers.microsoft.com/t5/Community-Support/ct-p/mpp_community_support Copilot Studio: https://powerusers.microsoft.com/t5/Community-Support/ct-p/pva_community-support   Community Support Form If you need more assistance, you can reach out to the Community Team via the Community support form. Choose the type of support you require and fill in the form accordingly. We will respond to you promptly.    Thank you for being an active part of our community. Your contributions make a difference!   Best Regards, The Community Management Team

Calling all User Group Leaders and Super Users! Mark Your Calendars for the next Community Ambassador Call on May 9th!

This month's Community Ambassador call is on May 9th at 9a & 3p PDT. Please keep an eye out in your private messages and Teams channels for your invitation. There are lots of exciting updates coming to the Community, and we have some exclusive opportunities to share with you! As always, we'll also review regular updates for User Groups, Super Users, and share general information about what's going on in the Community.     Be sure to register & we hope to see all of you there!