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
5 replies
Subscribers
7 subscribers
Views
2156 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
Hi I am using calworkhours(start_datetime, end_datetime) function to
sivananthag
over 8 years ago
Hi
I am using calworkhours(start_datetime, end_datetime) function to get the workhours Number(Integer) between two datetime ( timestamps). It returns only the integer. but need the result to be with more precision - hours & minutes as decimal. for example 4 hrs 30 mts to be returned as 4.50. Is there any function in Appian to return work hours with the precision of minutes ( as decimal value)?
thanks
Jhothi
OriginalPostID-166654
OriginalPostID-166654
Discussion posts and replies are publicly visible
0
Stefan Helzle
A Score Level 3
over 8 years ago
The expression "end_datetime - start_datetime" returns a value of type interval which represents a duration.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
neelimaj
over 8 years ago
Hi Jhothi, perform endDateTime - startDateTime and use todecimal(hour(endDateTime - startDateTime)&"."&minute(endDateTime - startDateTime)) to get the value in decimal form.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sivananthag
over 8 years ago
endDateTime - startDateTime gives the difference in time, but i need only work hours & minutes to be returned. for example if i give startDatetime as 10 Sept 2015 3.10 pm and endDateTime as 11 sept 2015 2.00 pm, I need to get the work hours and mins as 6 hrs 50 mins for a work day of 9am to 5 pm. due to this reason , I have used calworkhours, but it returned integer value as 6 hours.
thanks
Jhothi
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Stefan Helzle
A Score Level 3
over 8 years ago
Depending on how calworkhours works you could calculate the minutes part on its own. "minute(end) - minute(start)" should give you some value. Dividing 60 by that value gives you a fraction of an hour which you can add or subtract from the hour value calworkhours gives you.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
siddharthg837
over 8 years ago
@sivananthg: Hi, I too landed in this use case and the way I approached was by setting up a new table in the database and storing all working days for each month of the year. And then created a stored procedure function that takes your two date time time stamps and your business logic in that stored procedure function will return the work hours taking reference of working days setup in the table.
And then call your stored procedure on Appian.
The advantage of the above is that all this complex calculation can be avoided on Appian and thus doesn't hampers performance.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel