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
12 replies
Subscribers
8 subscribers
Views
5022 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
Hi All, Currently I am working on a requirement where we need to comp
souravs
Certified Lead Developer
over 9 years ago
Hi All,
Currently I am working on a requirement where we need to compute the number of months based on start date and end date. Suppose say for example start date is 25/12/2015 and end date is 31/03/2017. The total number of months should be calculated as 15 months including the date precision. How to achieve this functionality?
OriginalPostID-183629
OriginalPostID-183629
Discussion posts and replies are publicly visible
Parents
0
Rahul Gundu
over 9 years ago
Try the below code.
with(
local!years:year(ri!todate)-year(ri!fromDate),
local!months:(local!years)*12+(month(ri!todate)-month(ri!fromdate))-1,
local!days:(daysinmonth(month(ri!fromdate),year(ri!fromDate))-day(ri!fromDate))+day(ri!todate),
local!months&" months, "&local!days&" days"
)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Reply
0
Rahul Gundu
over 9 years ago
Try the below code.
with(
local!years:year(ri!todate)-year(ri!fromDate),
local!months:(local!years)*12+(month(ri!todate)-month(ri!fromdate))-1,
local!days:(daysinmonth(month(ri!fromdate),year(ri!fromDate))-day(ri!fromDate))+day(ri!todate),
local!months&" months, "&local!days&" days"
)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Children
No Data