How to count number of dates between two dates

Hi @sruthesanju

I think the output 19 is correct.

If you see the below image Date 2 is just started. So, until Date 2 is fully completed the duration will remain as 19 days

image

In the below image Date 2 is almost ended but still 1 second remaining. So, until Date 2 is fully completed the duration remain as 19 days

image

In the below image Date 2 is completed and next day started. So, the duration now is 20 days

image

If you want 20 days as an output then please add +1 days to your Date 2

DateTime.ParseExact(“01/20/2022”,“MM/dd/yyyy”,System.Globalization.CultureInfo.InvariantCulture).AddDays(1)

Thanks
John