Convert date module datetime into local time in Drupal

By default drupal date module stores all the values in the UTC format and to change it into the current local time format you can do something suggested in this post for the conversion :

The above post will give you exact local time after conversion which can be used in sql query for comparison.