I want exact Year, Month and Day elapsed between two dates.
DateTime startDate = new DateTime(1974, 8, 15);
DateTime endDate = DateTime.Now.ToLocalTime();
I wish to find Number of Years, Months and Days elapsed between the above two days using C#?
My Expected Output
Years: 68 Months: 10 Days: 23
I referred one of the post, in that they explained about only days Calculate difference between two dates (number of days)?
But I need all three - Year, Month and Day. Kindly assist me how to calculate...
Explanation for Duplicate: Already a question with same logic posted in Calculate Years, Months, weeks and Days, the answer provided in that question is too lengthy and in my question I asked only Year, Month and Date not Week. The Concept is same but the logic is different for calculating days comparing to that question, Here I got the answer in a very simplified manner. I satisfied in my answer.
Exact Duplicate:
Original Question: How to get difference between two dates in Year/Month/Week/Day? (Asked 7 Years ago)
Your Marked Question: Calculate Years, Months, weeks and Days (Asked 5 Years ago)