web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Adding Work Shifts

(0) ShareShare
ReportReport
Posted on by 2

I have a date/time field named Scheduled (orr_scheduled) and I am wanting to create a calculated column and have it populate the shift number (1-3).

They are 7-15, 15-23, 23-7. I cannot seem to find a function for obtaining the hour of the date/time field to then perform the calculation.

The ideas I can think of:

  • Creating multiple calculated columns to identify the number of hours and/or minutes since a set date and divide by either 24 (hours) or 1440 (minutes) and take the remainder to identify the hour/minute.
  • Use JS to populate the field on creation/modification.

One worry I have is the fact that there are timezones in play here. Any suggestions are welcome.

I have the same question (0)
  • Leah Ju Profile Picture
    Microsoft Employee on at

    Hi,

    Could you share screenshots about it?

  • Bahalzamon Profile Picture
    2 on at

    im not sure what your wanting a picture of.

    all i have as of yet is a date field of Scheduled and I want another column named Shift with a numerical whole number value of 1-3 based on the above hour designation.

    Basically i just need to get the hour value that is stored within the date/time value of Scheduled.

  • Verified answer
    Leah Ju Profile Picture
    Microsoft Employee on at

    Hi,

    Maybe you can refer to the following link:

    www.cloudfronts.com/.../

  • Suggested answer
    Bahalzamon Profile Picture
    2 on at

    thanks for the reply, i was looking more for something that could be based on the time and time zone which doesn't seem to be possible.

    so i ended up doing js but as i just needed 1-3 for the desired shift here's what i did.

    function datetoShift(dateValue){
    	var totalmin = (dateValue.getHours()*60) dateValue.getMinutes();
    	if(totalmin>1380 || totalmin<=420){
    		return 3;
    	}else if(totalmin>900){
    		return 2;
    	}else if(totalmin>420){
    		return 1;
    	}else{
    		return 0;
    	}
    }

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

News and Announcements

Season of Giving Solutions is Here!

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
iampranjal Profile Picture

iampranjal 65

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 34 Super User 2025 Season 2

#3
Pallavi Phade Profile Picture

Pallavi Phade 24

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans