Date Subtraction

@Shin_Sam @sangasangasanga

If the date format is an issue, a better way to do this would be to use DateTime.ParseExact() method and specify the exact format of the date:

(DateTime.ParseExact(“10/01/2018”,“MM/dd/yyyy”,CultureInfo.InvariantCulture)-DateTime.ParseExact(“04/02/2018”,“MM/dd/yyyy”,CultureInfo.InvariantCulture)).Days

This shall give you the same output (182) which as mentioned earlier you can divide by 30 to see if the dates have a 6-month difference or not.

3 Likes