Extract method to set the date