Can anyone please explain what the following code checks for? I can make no sense of it, but don't want to leave it out of my rewrite merely out of ignorance. The complete code calculates a variance between now and detailLastDate
, i.e. Days(detailLastDate) - Days(Now)
. For this case, detailLastDate
has the value '090722':
int num3 = 0;
num3 = int.Parse(detailLastDate.Substring(0, 1) + int.Parse(detailLastDate.Substring(1, 1) + int.Parse(detailLastDate.Substring(2, 1) + int.Parse(detailLastDate.Substring(3, 1) + int.Parse(detailLastDate.Substring(4, 1)
+ int.Parse(detailLastDate.Substring(0, 1) + int.Parse(detailLastDate.Substring(1, 1) + int.Parse(detailLastDate.Substring(2, 1) + int.Parse(detailLastDate.Substring(3, 1) + int.Parse(detailLastDate.Substring(5, 1);
if (num3 == 0)
{
detailLastDate = "991231";
}
ADDED: What puzzles me is why it parses chars 0 to 3 twice.