How to calculate date difference in terms of months? And count number of application exceeding a certain lifespan?
I have two parts of questions regarding date differences:
I want to calculate the date difference in terms of month. For example, i am given an application with a certain start date, i want to calculate the duration (or so called "lifespan") of the application. In terms of days, i can use this expression:
Doesn't this equation pose a problem. For example 01032017 - 28022017 would produce the result as one month. However in fact, only one day has passed. I want to include the days in counting the month difference. If there is no way, i can just count the days difference and divide it by 30.
Re: How to calculate date difference in terms of months? And count number of application exceeding a certain lifespan?
Thanks for your suggestion. I understand the convenience of converting the field to a proper date value during the initial load. Given my environment i am unable to do so, this is because i am not using the data manger to add it but rather the data load editor to load the table from a script.
That aside, i have formulated the code you provided which allows me to count the months.
This poses the same problem as mentioned earlier. Comparing dates between 01032017 and 28022017 gives me the difference as 1 month, when in fact it should be 0 as only one day has passed. What i would like is to be able to compare the entire date field.
28032017 - 28022017 = 1 month
05042017 - 28022017 = 1 month
28042017 - 29022017 = 2 months
31012017 - 28022017 = 1 month (because its the last day of Feb)
I'm not sure if you catch my drift, but if there is no function or expression to calculate this, i guess i'll just go with the assumption the every month has 30 days.