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

#### A Celebration of What We've Achieved--And Announcing Our Winners

As the sun sets on the #SummerofSolutions Challenge, it's time to reflect and celebrate! The journey we embarked upon together was not just about providing answers – it was about fostering a sense of community, encouraging collaboration, and unlocking the true potential of the Power Platform tools.   From the initial announcement to the final week's push, the Summer of Solutions Challenge has been a whirlwind of engagement and growth. It was a call to action for every member of our Power Platform community, urging them to contribute their expertise, engage in discussions, and elevate collective knowledge across the community as part of the low-code revolution.   Reflecting on the Impact As the challenge ends, it's essential to reflect on the impact it’s had across our Power Platform communities: Community Resilience: The challenge demonstrated the resilience of our community. Despite geographical distances and diverse backgrounds, we came together to contribute, learn, and collaborate. This resilience is the cornerstone of our collective strength.Diverse Expertise: The solutions shared during the challenge underscore the incredible expertise within our community. From intricate technical insights to creative problem-solving, our members showcased their diverse skill sets, enhancing our community's depth.Shared Learning: Solutions spurred shared learning. They provided opportunities for members to grasp new concepts, expand their horizons, and uncover the Power Platform tools' untapped potential. This learning ripple effect will continue to shape our growth. Empowerment: Solutions empowered community members. They validated their knowledge, boosted their confidence, and highlighted their contributions. Each solution shared was a step towards personal and communal empowerment. We are proud and thankful as we conclude the Summer of Solutions Challenge. The challenge showed the potential of teamwork, the benefit of knowledge-sharing, and the resilience of our Power Platform community. The solutions offered by each member are more than just answers; they are the expression of our shared commitment to innovation, growth, and progress!   Drum roll, Please... And now, without further ado, it's time to announce the winners who have risen above the rest in the Summer of Solutions Challenge!   These are the top community users and Super Users who have not only earned recognition but have become beacons of inspiration for us all.   Power Apps Community:  Community User Winner: @SpongYe Super User Winner: Pending Acceptance Power Automate Community:  Community User Winner: @trice602 Super User Winner: @Expiscornovus  Power Virtual Agents Community: Community User Winner: Pending AcceptanceSuper User: Pending Acceptance Power Pages Community: Community User Winner: @OOlashyn Super User Winner: @ChristianAbata   We are also pleased to announced two additional tickets that we are awarding to the Overall Top Solution providers in the following communities:    Power Apps: @LaurensM   Power Automate: @ManishSolanki    Thank you for making this challenge a resounding success. Your participation has reaffirmed the strength of our community and the boundless potential that lies within each of us. Let's keep the spirit of collaboration alive as we continue on this incredible journey in Power Platform together.Winners, we will see you in Vegas! Every other amazing solutions superstar, we will see you in the Community!Congratulations, everyone!