Fix DATETIME_FORMAT, DATE_FORMAT, TIME_FORMAT settings.  Closes #798