Show only posts from todays date [duplicate]

If you just want posts from today, it’s super easy and right in the WP codex:

<?php
$today = getdate();
$args = array(
    'date_query' => array(
        array(
            'year'  => $today['year'],
            'month' => $today['mon'],
            'day'   => $today['mday'],
        ),
    ),
);
$custom_query = new WP_Query( $args );
?>

<?php if ($custom_query->have_posts()) : while ($custom_query->have_posts()) : $custom_query->the_post(); ?>

  <?php get_template_part( 'content', get_post_format() ); ?>

<?php endwhile; endif; // end of custom loop ?>
<?php wp_reset_postdata(); ?>