Calculating and populating a date field