Test

Test

  • NA
  • 58
  • 51k

How to get months difference between two dates in c#

Sep 11 2019 3:06 AM
I have two date fields where i need to caluculate difference in months between those two dates how can i do this.Below is my formula
(start.Year * 12 + start.Month) - (end.Year * 12 + end.Month);
 
Expected Result
Start Date End Date Need to get output as
08/28/2019 09/02/2019 1
06/01/2019 09/02/2019 4
01/02/2019 03/02/2019 3
01/02/2019 03/05/2019 3
 

Answers (11)