Question: I'm new in mysql and I'm currently having an issue with a query. I need to get an average duration for each activity each day within a week. The date format is like: '2000-01-01 01:01:01', but I want to get rid of the 01:01:01 thing and only care about the date. How do I do that?

The table is something like this:

```
record_id   int(10)      NOT NULL,
activity_id varchar(100) NOT NULL,
start_time  datetime     NOT NUll,
end_time    datetime     NOT NULL,
duration    int(10)      NOT NULL;

```

Thanks.

Answer: 
The easiest way I think you can do that is using the elmah library.

Take a look at this: <http://code.google.com/p/elmah/wiki/MVC> and this 
<http://www.hanselman.com/blog/ELMAHErrorLoggingModulesAndHandlersForASPNETAndMVCToo.aspx>
you can create custom exception in MVC if you want to customize a way of exception handling.
you can find useful post here .
<http://www.professionals-helpdesk.com/2012/07/creating-custom-exception-filter-in-mvc.html>