Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
4 replies
Subscribers
9 subscribers
Views
2405 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
General
Hi, Is there a way to get the end of business hours for a day from a calend
arjunv
over 9 years ago
Hi,
Is there a way to get the end of business hours for a day from a calendar?
For Example, If 9AM - 5PM is the business hours as per the calendar and a date is given as input, can we get the end of business hours for that particular day?
Thanks in advance
OriginalPostID-191582
OriginalPostID-191582
Discussion posts and replies are publicly visible
0
PhilB
A Score Level 1
over 9 years ago
There's not a function that does exactly that as far as I know, but you can get close using the out-of-the-box functionality with something like the expression below. It's not particularly nice but it returns an array of 24 booleans that equate to the 0-23 hours of the given date, where the true/false value of each index indicates whether or not it's a working day. It would be possible to expand on this down to the minute with a little more work.
apply(
fn!calisworktime,
apply(
fn!datetime(
year(
ri!date
),
month(
ri!date
),
day(
ri!date
),
_,
0,
0,
0
),
enumerate(
24
)
)
)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
PhilB
A Score Level 1
over 9 years ago
I should add that the array is still 1-indexed, so index 9 = 8am, and for your use case you'd want to find the last index that is true, so you'd wrap this function in where() and max() to get the highest index that is true. You'd also probably want to take into account timezones when doing this.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
PhilB
A Score Level 1
over 9 years ago
Also where i say "whether or not it's a working day" up there, I meant "working hour"
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
arjunv
over 9 years ago
Thanks @philb.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel