I am a new comer to wordress and php. I have to display all posts from june 2009 to june 2010. How do i do this by developing a custom loop?

query_posts() just let it show posts from the specific week or month. However, you are able to show posts between two dates, adding a couple of lines of code. You have to paste this code wherever inside your theme you want to display.

<?php
      function filter_where($where = '') {
            $where .= " AND post_date >= '2009-06-01' AND post_date <= '2010-06-30'";
        return $where;
      }
        add_filter('posts_where', 'filter_where');
        query_posts($query_string);
        while (have_posts()) :
          the_post();
          the_content();
        endwhile;
    ?>

Source: http://bit.ly/i5zXP0