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: 
**For Global Error Handling**    

All you have to do is change the customErrors mode="On" in web.config page   

Error will be displayed through Error.cshtml resides in shared folder.   

*Make sure that Error.cshtml Layout is not null*.  

[It sould be something like: @{ Layout = "~/Views/Shared/\_Layout.cshtml"; }   

Or remove Layout=null code block] 

A sample markup for Error.cshtml:- 

```
@{ Layout = "~/Views/Shared/_Layout.cshtml"; } 

@model System.Web.Mvc.HandleErrorInfo

<!DOCTYPE html>
<html>
<head>
    <title>Error</title>
</head>
<body>
    <h2>
        Sorry, an error occurred while processing your request.
    </h2>
    <p>Controller Name: @Model.ControllerName</p>
    <p>Action Name : @Model.ActionName</p>
    <p>Message: @Model.Exception.Message</p>
</body>
</html>

```

**For Specific Error Handling**  

Add HandleError attribute to specific action in controller class. Provide 'View' and 'ExceptionType' for that specific error.  

A sample NotImplemented Exception Handler:   

```
public class MyController: Controller
    {
        [HandleError(View = "NotImplErrorView", ExceptionType=typeof(NotImplementedException))]
        public ActionResult Index()
        {
            throw new NotImplementedException("This method is not implemented.");
            return View();
        }
}

```
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>