How to show only today's post?

I want to show only today’s or current date post in my blog.
Here is my code but it’s not working.

<?php   
$day = date('j');   
query_posts('day='.$day);   
if (have_posts()) :
while (have_posts()) : the_post();  
?>
<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="view: <?php the_title(); ?>"><?php the_title(); ?></a></h3>
<div class="storycontent"><?php the_content(); ?></div>
<?php endwhile; ?>
<?php endif; ?>

How to solve this?

Solutions Collecting From Web of "How to show only today's post?"

This should do the trick:

<?php
$day = date('Ymd');
query_posts("m=$day");

The query arg 'm' for WordPress will be interpreted as a year if it is four characters long, a month if 6, and a date if 8.

EDIT

You should probably add in the original query string just in case you’re writing enough to need things like pagination:

<?php
global $query_string;
$query_string = empty($query_string) ? 'm=' : $query_string . '&m=';
$query_string .= date('Ymd');
query_posts( $query_string );

That will allow you to preserve other query arguments that are supposed to be there.

I think you’ll need to set the month and year also(possibly), see the Time Parameters for WP_Query, parameters shown throughout that page also apply to query_posts.

This is how I would do it.

<?php
$today = getdate();

query_posts( array(
    'year' => $today["year"],
    'monthnum' => $today["mon"],
    'day' => $today["mday"]
) ); 

// Do your loop... thingy.

You could also do it without modifying the theme. In WP Admin: Settings > Reading > Blog pages show at most: 1 posts