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

#### April 4th Copilot Studio Coffee Chat | Recording Now Available

Did you miss the Copilot Studio Coffee Chat on April 4th? This exciting and informative session with Dewain Robinson and Gary Pretty is now available to watch in our Community Galleries!   This AMA discussed how Copilot Studio is using the conversational AI-powered technology to aid and assist in the building of chatbots. Dewain is a Principal Program Manager with Copilot Studio. Gary is a Principal Program Manager with Copilot Studio and Conversational AI. Both of them had great insights to share with the community and answered some very interesting questions!     As part of our ongoing Coffee Chat AMA series, this engaging session gives the Community the unique opportunity to learn more about the latest Power Platform Copilot plans, where we’ll focus, and gain insight into upcoming features. We’re looking forward to hearing from the community at the next AMA, so hang on to your questions!   Watch the recording in the Gallery today: April 4th Copilot Studio Coffee Chat AMA