Validate date parameters and convert them to datetime