Adding format for dates and checking for null