Handle DB errors and allow custom date format.