Question: I use the cakePHP framework I have a question about how models handle MySQL query connections. Basically I have a model which I need to set recursive level of 2, to get to some information in a deeper model. Although I have removed all binding of level 2 models which I do not need the framework is still executing a large number of queries to build the result set. 

What I want to know is if the framework opens and closes a MySQL connection for every query or does it open a single connection and executes all the queries and then close the connection?

Thanks

Answer: 
Instead of `new DateTime()` you need `DateTime.Now` for current date

so your check should be:

```
date.CompareTo(DateTime.Now.AddDays(-30)) < 0

```

You can also do:

```
if(date < DateTime.Now.AddDays(-30))

```

EDIT: (from comment of @Rawling) 

If you want to compare against the Date part of the DateTime, then you may use `DateTime.Now.Date` or `DateTime.Today` instead of `DateTime.Now` which will point to current date with `12:00AM` time

```
date.Compare(DateTime.Now.Date.AddDays(-30)) < 0

```
You can try with 

```
DateTime.Now.AddDays(-30);

```